Replies: 1 comment
-
The Templater plugin has the same problem, and their documentation contains some interesting links: https://silentvoid13.github.io/Templater/faq.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think on Unix like operating systems the Bash / Dash / Zsh shells work quite nicely with the
UTF-8
encoding. At least I haven't yet encountered issues for them.But on Windows..... It's a sad, sad situation. I tried to research for a solution for encoding problems in CMD in issue #5, but failed. I decided not to try anymore to find a solution for CMD. I thought that the newer shells, PowerShell 5 / PowerShell Core would fix the encoding issues, but no. At least not automatically.
An example of bad output on PowerShell 5 / PowerShell Core
This can be fixed by preceding the command with:
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding;
(Source)So the command becomes:
And the output is now correct:
![kuva](https://user-images.githubusercontent.com/13002142/154810308-f00287be-ddbc-4b86-84b6-fb1875b712a9.png)
This is only a workaround, and I want to find a more easy to use solution.
Different ways to try to solve this problem
child_process
module'sexec()
function has an option namedencoding
, that Node.js uses to convert output from the specified encoding to utf-8. The issue with this is that the set of supported encodings seems to be quite limited: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex".$OutputEncoding = ...
code. Again, manual work for users, and very confusing for newcomers.What about input encoding?
I want to emphasize that this discussion is only about output encoding. PowerShell's input encoding has problems, too (e.g. discussion #155 - edit: actually, it might be that that discussion does not have an input related issue, but output instead, as the problem occurs in error message output). This whole encoding topic is so huge and confusing to me that I try to solve it in smaller pieces. If I do find a solution to this output encoding problem, maybe it will lead to a solution for input, too. But that discussion can be started in a different discussion topic.
Beta Was this translation helpful? Give feedback.
All reactions