1

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

cmd

powershell


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 powershell


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>
Yasushiki
  • 11
  • 3
  • 2
    The answer you link to is focused on making PowerShell cmdlets _output_ UTF-8 (I've updated it to make that clearer). The more relevant answer may be [this one](https://stackoverflow.com/a/49481797/45375). – mklement0 Sep 05 '21 at 23:15

0 Answers0