A bug happens when compiling zh-Hans characters with ReScript@9.x on Windows

When i’m using ReScript@9 to processing Chinese characters on my Windows computer, some compiler bugs shows.

This is raw code ↓

let a = "这是一段中文"

let fn = t=>j`$t现在通过函数返回`

let fn_u = (. t)=>j`$t现在通过Uncurried函数返回`

let r1 = fn(a)

let r1_1 = a->fn

let r2 = fn_u(. a)

let r3 = "这里也是一些文字"->fn

Js.log(r1)
Js.log(r1_1)
Js.log(r2)

And this is compiled code ↓

We can clearly find the chinese character are not compilered correctly.

Honestly, I’m not sure if it’s the exception or the general case, and i found the docs shows ReScript have proper unicode handling.

This is a minimal reproduction case, only shows on Windows.

Please help me, thanks a lot !

1 Like

In the 9th version you need to use backticks. Unicode support for " is added in the rescript@10.

let a = `这是一段中文`
5 Likes

But still have error behavior, playground

Strange, this code should work, but it doesn’t playground.

Probably a playground issue, because I’ve tried it locally with rescript@9.1.4 and it works fine.

i just try it on my macbook, rescript v9 and v10 are both not work, it’s weird.
maybe it’s a compiler bug.

Can you file an issue in the ReScript compiler repo?

1 Like

i’ll submit later, thanks!

2 Likes