Ruby will be garbled if you use VS Code and output the following code.
code:
address={name: "Takahashi", furigana: "Takahashi", postal: "1234567"}
Output:
{:name=>"\u9AD8\u6A4B",:furigana=>"\u30BF\u30AB\u30CF\u30B7",:postal=>"1234567"}
How can I solve this problem?
ruby garbled-characters
It's not garbled, it's escaped because the encoding of the string literal and the external encoding do not match.
You are probably using p
, but p
is basically a debugging method, and if the encoding does not match, it behaves like this.
There is a way to adjust the external encoding to UTF-8.
However, in Japanese Windows environments, the external encoding is generally Windows-31J, so existing scripts that are written on that premise may malfunction.
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.