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

Unicode characters are not correctly parsed from byte[] if default charset is not UTF-8 #73

Closed
dpeger opened this issue Apr 23, 2021 · 0 comments · Fixed by #74
Closed

Comments

@dpeger
Copy link
Contributor

dpeger commented Apr 23, 2021

The TestUtf8.supportI18nBytes test is currently broken on windows systems. Actually in my IDE (IntelliJ) the test is green. but the maven test target fails both in the IDE and on command line:

[ERROR] Failures:
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Amharic text ==> expected: <አማርኛ> but was: <አማርኛ>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Malayalam text ==> expected: <മലയാളം> but was: <മലയാളം>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Assyrian Neo-Aramaic text ==> expected: <ܐܬܘܪܝܐ> but was: <Ü?ܬܘܪÜ?Ü?>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Georgian text ==> expected: <მარგალური> but was: <მáƒ?რგáƒ?ლური>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Sinhala text ==> expected: <සිංහල ජාතිය> but was: <සිංහල ජà·?තිය>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Japanese text ==> expected: <日本語> but was: <日本語>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Russian text ==> expected: <Русский> but was: <РуÑ?Ñ?кий>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Farsi text ==> expected: <فارسی> but was: <Ù?ارسی>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Korean text ==> expected: <한국어> but was: <한국어>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Armenian text ==> expected: <Հայերեն> but was: <Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Hindi text ==> expected: <हिन्दी> but was: <हिनà¥?दी>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Hebrew text ==> expected: <עברית> but was: <עברית>
[ERROR] TestUtf8.supportI18nBytes:62 Parsing bytes[] Chinese text ==> expected: <中文> but was: <中文>

The problem seems to be the creation of String using the system's default charset in JSONParserByteArray.extractString

xs = new String(in, beginIndex, endIndex - beginIndex);

and JSONParserByteArray.extractStringTrim

UrielCh added a commit that referenced this issue Apr 24, 2021
…alization-from-byte-array

[#73] Avoid `String` creation using system default charset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant