Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unicode strings inside the first argument to Printf.sprintf get garbled #1000

Closed
feihong opened this issue Dec 23, 2023 · 0 comments · Fixed by #1001
Closed

Unicode strings inside the first argument to Printf.sprintf get garbled #1000

feihong opened this issue Dec 23, 2023 · 0 comments · Fixed by #1001

Comments

@feihong
Copy link

feihong commented Dec 23, 2023

Here's a simple example:

let message = Printf.sprintf({js|Greetings and 你好, %s!|js}, "Jon");
Js.log(message);

This produces

Greetings and ä½ å¥½, Jon!

Playground link


Interestingly, native OCaml doesn't have this problem:

% ocaml
OCaml version 5.0.0
Enter #help;; for help.

# Printf.printf {js|Greetings and 你好, %s!|js} "Jon";;
Greetings and 你好, Jon!- : unit = ()
#
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant