I'm using ReasonReact
with bsb -init myapp -theme react-hooks
. I run my project on MacOS Catalina. When building or starting my project, Bucklescript
is compiling my utf8
*.re
files into us-ascii
. This results into bad encoded accentuated characters. I cannot figure out why. Thanks for helping me out.
Asked
Active
Viewed 176 times
1
1 Answers
3
It's not clear from the question whether you use unicode characters only in string literals, or in identifiers.
If the former, BuckleScript provides syntax for unicode string literals, which should be translated correctly:
let unicode = {js|你好, 世界|js};
If you use unicode in identifiers, however, the compiler unfortunately does not support that. It's an internal limitation inherited from the OCaml compiler.

glennsl
- 28,186
- 12
- 57
- 75
-
1I was looking for `{j|utf string here|j}`. Found ith thanks. – Neovea Mar 04 '20 at 10:47
-
Unicode in identifiers can be a mixed blessing. E.g. here's a list of visually similar but syntactically invalid Unicode graphemes that the Rust compiler has to know about in case people try to use them in source code: https://github.com/rust-lang/rust/blob/b43eb4235ac43c822d903ad26ed806f34cc1a14a/src/libsyntax/parse/lexer/unicode_chars.rs – Yawar Mar 04 '20 at 14:35