Skip to content

TextDecoder regressed for ascii, windows-1252, ... encodings in v23.4.0 #56219

Closed
@lutzroeder

Description

@lutzroeder

Version

23.4.0

Platform

macOS 15.1.1 (24B91)

Subsystem

No response

What steps will reproduce the bug?

~: node
Welcome to Node.js v23.4.0.
> b = new Uint8Array([97, 108, 101])
> decoder = new TextDecoder('ascii')
> decoder.decode(b)
<Buffer 61 6c 65>

How often does it reproduce? Is there a required condition?

Reproduces reliably.

What is the expected behavior? Why is that the expected behavior?

Returns a string instead of a buffer. See output from v23.3.0:

~: node
Welcome to Node.js v23.3.0.
> b = new Uint8Array([97, 108, 101])
> decoder = new TextDecoder('ascii')
> decoder.decode(b)
'ale'

What do you see instead?

Returns a buffer.

Additional information

@mertcanaltin @RafaelGSS @anonrig @jasnell @lemire @targos #55275

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions