denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.92k stars 5.22k forks source link

Using Luma and Deno serve generates � between each letter in the md file #18825

Closed TonyKnibb-MakaraHealth closed 1 year ago

TonyKnibb-MakaraHealth commented 1 year ago

I ran echo 'Hello world' > index.md which created the file, and populated it with Hello world.

Running deno task serve results in an html file that's like this:

< !DOCTYPE html > < p>��H�e�l�l�o� �w�o�r�l�d�< /p>

[spaces in tags added for formatting here]

Adding anything additional to the md file results in the same thing happening to that too.

bartlomieju commented 1 year ago

Please provide full reproduction code

lucacasonato commented 1 year ago

Your file is being stored in UTF-16, but you are reading it as UTF-8. Are you on Windows, and populated the file using "cmd.exe"?

TonyKnibb-MakaraHealth commented 1 year ago

Your file is being stored in UTF-16, but you are reading it as UTF-8. Are you on Windows, and populated the file using "cmd.exe"?

The file was created via the cmd window in PhpStorm, on Windows 10.

TonyKnibb-MakaraHealth commented 1 year ago

Please provide full reproduction code

Thanks for the reply. Not sure I fully understand the request.

I downloaded and installed Deno on Win 10. I upgraded Deno to latest version 1.32.5 and installed Lume. I ran the command (as it was shown in the cmd output window) to create an md file containing Hello world. I got the above result.

I don't have any other code, as I haven't done anything yet.

lucacasonato commented 1 year ago

This is not a bug in Deno, it is unfortunately just how Windows works (legacy parts of it use UTF-16 instead of UTF-8 like the rest of the world). If you create this file via the PhpStorm editor, it likely won't have this issue. cmd.exe is one of these legacy things that use UTF-16

TonyKnibb-MakaraHealth commented 1 year ago

That seems to have fixed my issue.

Thanks!