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.iter8 throws for 0x7F on Neko #8139

Closed
Aurel300 opened this issue Apr 10, 2019 · 4 comments
Closed

Utf.iter8 throws for 0x7F on Neko #8139

Aurel300 opened this issue Apr 10, 2019 · 4 comments
Labels
platform-neko Everything related to Neko unicode

Comments

@Aurel300
Copy link
Member

class Main {
  public static function main():Void {
    var str = "\x7Fa";
    haxe.Utf8.iter(str, cp -> trace(cp));
  }
}

Expected output: 127 and 97 (works on Python, JS, Java, eval, C++, …)

Neko v2.2.0:

Called from ? line 1
Called from Main.hx line 4
Called from /.../haxe/std/neko/_std/haxe/Utf8.hx line 72
Uncaught exception - std@utf8_iter
@Aurel300 Aurel300 added platform-neko Everything related to Neko unicode labels Apr 10, 2019
@Aurel300
Copy link
Member Author

This line is the culprit:

https://github.com/HaxeFoundation/neko/blob/master/libs/std/utf8.c#L362

(should be <= 0x7F)

There is a similar problem in HashLink, though it does not throw:

https://github.com/HaxeFoundation/hashlink/blob/master/src/std/string.c#L89

Additionally neither C0, C1 (overlong sequence start), nor F5FF (codepoints higher than allowed in Unicode) are rejected.

@ncannasse
Copy link
Member

ncannasse commented Apr 11, 2019 via email

@ncannasse
Copy link
Member

@Aurel300 can you submit a PR for Neko?

ncannasse added a commit to HaxeFoundation/neko that referenced this issue Apr 23, 2019
@ncannasse
Copy link
Member

Nevermind I fixed it directly online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-neko Everything related to Neko unicode
Projects
None yet
Development

No branches or pull requests

2 participants