Skip to content

[buffer] transcode() to utf16le is broken #9834

Description

@trevnorris
  • Version: v7.2.0
  • Platform: Linux
  • Subsystem: buffer

Examples of brokenness:

// note: this works properly if `fromEnc` is 'utf8'
buffer.transcode(Buffer.from('hi', 'ascii'), 'ascii', 'utf16le')
// expect: <Buffer 68 00 69 00>
// get:    <Buffer 68 00 69 00 00 00 00 00 60 db 18 c6 fe 7f 00 00>

buffer.transcode(Buffer.from('hi', 'latin1'), 'latin1', 'utf16le')
// expect: <Buffer 68 00 69 00>
// get:    <Buffer 68 00 69 00 00 00 00 00 60 db 18 c6 fe 7f 00 00>

buffer.transcode(Buffer.from('\u00e4', 'latin1'), 'latin1', 'utf16le')
// expect: <Buffer e4 00>
// get:    <Buffer e4 00 00 00 fe 7f 00 00>

Not sure when I'll have time to look into this.

/cc @jasnell

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions