Skip to content

Exec while encoding as buffer still contains question marks instead of special characters #20871

Closed
@mm739521

Description

@mm739521
  • Version:6.10.3
  • Platform:Windows

I'm attempting to echo a string with special characters in it (téstér) with the child_process.exec(command[, options][, callback]) .

stdout is returning t?st?r. As per instructions I added the {encoding: 'buffer'} which is returning the buffer value of <Buffer 74 82 73 74 82 72 0d 0a>. If I create a new Buffer object using let test = Buffer.from('téstér') I get back the value of <Buffer 74 c3 a9 73 74 c3 a9 72>.

Why are these returning different values? I'm about to decode the value from the Buffer.from object I create, with the special characters, but when I attempt to do the same to the stdout I still get the t?st?r value.

Am I doing something incorrect here? Any help would be greatly aprreciated.

It seems the {encoding: 'buffer'} is treating the é as 82. Which is a linebreak according to this https://www.fileformat.info/info/unicode/char/0082/index.htm

Metadata

Metadata

Assignees

No one assigned

    Labels

    wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions