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

UTF-8 decoder produces incorrect number of replacement characters #49967

Closed
chykon opened this issue Sep 14, 2022 · 2 comments
Closed

UTF-8 decoder produces incorrect number of replacement characters #49967

chykon opened this issue Sep 14, 2022 · 2 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior library-convert

Comments

@chykon
Copy link

chykon commented Sep 14, 2022

Dart SDK version: 2.18.0 (stable) (Fri Aug 26 10:22:54 2022 +0000) on "linux_x64"

At https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt you can find a fairly well-known stress test for the UTF-8 decoder. If you try to decode this file using Dart, then in paragraph 3.3.7 there will be an insufficient number of replacement characters. Each malformed byte is expected to be replaced by a single U+FFFD character.

Minimal example available: https://dartpad.dev/?id=36ce63525a3b532328afd12de900d45a

@rakudrama
Copy link
Member

The Dart UTF-8 decoder used to generate one replacement character per malformed byte. We changed it to match the web standard. See #41100 for more details.

Since the current behavior is a deliberate choice, I suggest closing this issue as "by design".

/cc @lrhn @askeksa-google

@lrhn
Copy link
Member

lrhn commented Sep 15, 2022

I concur.

From the linked UTF-8-test.txt:

This file is not meant to be a conformance test. It does not prescribe any particular outcome.

@lrhn lrhn closed this as completed Sep 15, 2022
@lrhn lrhn added the closed-as-intended Closed as the reported issue is expected behavior label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior library-convert
Projects
None yet
Development

No branches or pull requests

3 participants