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

String functions behavior depens on target (Unicode support) #659

Open
ov7a opened this issue Jan 12, 2025 · 0 comments
Open

String functions behavior depens on target (Unicode support) #659

ov7a opened this issue Jan 12, 2025 · 0 comments

Comments

@ov7a
Copy link

ov7a commented Jan 12, 2025

C target treat strings as ASCII:

t[i] = kk_ascii_tolower(s[i]);

while JS treats them as unicode:
https://tc39.es/ecma262/multipage/text-processing.html#sec-string.prototype.tolowercase

Simple reproducer:

$ echo 'println("Добар Дан".to-lower)' | koka --target c
...
Добар Дан
$ echo 'println("Добар Дан".to-lower)' | koka --target js
...
добар дан

trim operation is also affected by this. In JS it's Unicode, while in C it's not:

$ echo 'println("a\xA0".trim ++ ".")' | koka --target c
...
a .
$ echo 'println("a\xA0".trim ++ ".")' | koka --target js
...
a.

As a user, I'd expect that all targets support Unicode.

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

No branches or pull requests

1 participant