Writing unicode characters

Hi !

I’m trying to right a unicode character in a string. However, the compiler will not let me :frowning:

let s = "\u{1D11E}"

yields

let s = "\u{1D11E}",
         ^^
Warning 14: illegal backslash escape in string.

However, this is not an illegal backslash is it ?

I know I could just copy paste the actual unicode character, but I find it less readable since my editor doesn’t show them

It’s becoming very frustrating because I can’t find a way of making this work, and even (flags -w -14) will not disable the warning for some reason…

I’m thankful for any help

The notation \u{...} was only added in OCaml 4.06.0, you probably need to update your OCaml version.

Sorry I forgot to mention that I’m using ocaml 4.08.1, so that’s not it unfortunately

You should check the version of the compiler that you are using then (do you have an older system compiler installed for instance?). Your code compiles fine with 4.08.1 .

1 Like

Oh god.
I am indeed using OCaml 4.8.1, but… with reason syntax on this one. This is my first time using Reason, I just assumed it would be the same. But the lexer was forked before 4.06, so it doesn’t have it ! This also explains why the -w -14 flag will not do anything

Thank you for your answer !!

This is indeed an issue on the Reason bug tracker: https://github.com/facebook/reason/issues/2337