Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textencoder decode to UTF8 with fatal true throws exception in version 22.7 #54628

Closed
eldoy opened this issue Aug 29, 2024 · 1 comment
Closed
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@eldoy
Copy link
Contributor

eldoy commented Aug 29, 2024

Version

22.7.0

Platform

Darwin v2.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

Running this code where 'value' is a string from my database will throw an error.

var util = require('node:util')
var textDecoder = new util.TextDecoder('utf8', { fatal: true })

textDecoder.decode(Buffer.from(value))

The error looks like this:

TypeError: The encoded data was not valid for encoding utf-8
    at TextDecoder.decode (node:internal/encoding:443:16)
    ...
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async main (/.../shared/test/integrity/checkEncoding.js:33:3) {
  code: 'ERR_ENCODING_INVALID_ENCODED_DATA'
}

It happens on specific values containing characters outside of [a-z], like æøå, but I'm not sure how to provide the actual string. Let me know if there's a technique I can use to convert the failing string to something portable.

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

It doesn't happen before version 22.7, have tested 22.6, 22.4, 22.0, 18 and 16 with the same data.

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

No error should be thrown.

What do you see instead?

Error.

Additional information

No response

@avivkeller
Copy link
Member

Duplicate of #54543

@avivkeller avivkeller marked this as a duplicate of #54543 Aug 29, 2024
@avivkeller avivkeller closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
@avivkeller avivkeller added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

2 participants