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

[hl] Unicode char swallows next character #8245

Closed
Aurel300 opened this issue May 2, 2019 · 1 comment
Closed

[hl] Unicode char swallows next character #8245

Aurel300 opened this issue May 2, 2019 · 1 comment
Assignees
Labels
platform-hl Everything related to HashLink unicode

Comments

@Aurel300
Copy link
Member

Aurel300 commented May 2, 2019

class Main {
  public static function main():Void {
    var str = "\u{10000}a";
    for (codepoint in haxe.iterators.StringIteratorUnicode.unicodeIterator(str)) trace(codepoint);
  }
}

Expected output:

$ haxe --main Main --interp
Main.hx:4: 65536
Main.hx:4: 97

On HL:

$ haxe --main Main --hl out.hl
$ hl out.hl
Main.hx:4: 65536

One character (byte?) is always missed after U+10000. It leads to more problems with subsequent multi-byte codepoints, but I'm sure the first one is the actual cause. Does not happen with U+FFFF or U+10001. Seems like an off-by-one error, since U+10000 is the first 4-byte codepoint in UTF-8.

Just trace on the string seems to produce the correct output (F0 90 80 80):

$ hl out.hl | xxd
00000000: 4d61 696e 2e68 783a 343a 20f0 9080 8061  Main.hx:4: ....a
...
@Aurel300 Aurel300 added platform-hl Everything related to HashLink unicode labels May 2, 2019
@Aurel300 Aurel300 self-assigned this May 2, 2019
@Aurel300
Copy link
Member Author

Aurel300 commented May 2, 2019

(Closed in 09a0d1e)

@Aurel300 Aurel300 closed this as completed May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-hl Everything related to HashLink unicode
Projects
None yet
Development

No branches or pull requests

1 participant