I recently started to use Vim, but I'm having some encoding problems, and I'm not really sure if it's a Ruby problem or a cmd/powershell problem, but Ruby is not accepting CJK characters with gets
, and sometimes printing isn't working properly.
gets error
The following images are from cmd and powershell, it shows how p
, puts
and print
print it (I don't know if it is important tho), and the code is just var = gets
printing "error"
In powershell, p
printing doesn't work if I use CJK (apparently it doesn't work with UTF-8), but in cmd all works perfectly
What I already tried:
Set cmd and powershell encoding as UTF-8: In cmd it worked, but in powershell I don't seems to work. I tried $PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
and $PSDefaultParameterValues['*:Encoding'] = 'utf8'
as in this answer
Changing cmd and powershell font: As you can see in the images, the font supports CJK (MS Mincho)
Open cmd with UTF-8: I'm using cmd /K chcp 65001
to open cmd
Other informations:
Windows 10
irb(main):001:0> RUBY_VERSION
=> "2.7.3"
irb(main):001:0> Encoding.default_external
=> #<Encoding:UTF-8>