0

When I run a standalone Javascript using nodejs in the Sublime Text Editor:

console.log("Hellø World!");

The output is displayed in the Build Result pane:

Hellø World!
[Finished in 54ms]

Screenshot of code and output with wrong encoding

Sadly, the encoding is wrong. Running node test.js works fine in a terminal whose default encoding is set to 'utf-8'. However, in Sublime Text, the default encoding (for new files) is also set to UTF-8, so I expected this to work fine too.

Note: ø (U+00F8) is encoded as 0xC3 0xB8 in UTF-8, and when 0xC3 0xB8 is interpreted as Latin-1, it will show up as ø. So that is what seems to be happening here.

How to I force Sublime Text to interpret the stdout (as displayed in the Build Result pane) as UTF-8 instead of Latin-1?

(Running MacOS 15.4, with Sublime Text build 4192 and nodejs v22.14.0)

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.