alire icon indicating copy to clipboard operation
alire copied to clipboard

Encoding problem in Windows 10

Open mosteo opened this issue 3 years ago • 4 comments

Reported by Henrik Hârkônen on gitter:

Hello all! I just noticed one "thing" when using Alire on Windows 10 for the first time. I created a new project with alr init --lib command and then it asked me stuff, like my name. And because my name is unfortunate to not contain only the ascii-7bit characters, reading the alire.toml when starting alr edit for example, fails to a "invalid UTF-8 encoding at" error. I was using the windows cmd -shell. I edited with VSCode the ä and ö characters to proper ones and then it worked, but I was wondering what caused this. Is the cmd shell reading the input as cp1252 and that get's written to the toml, or how does this go?

mosteo avatar Apr 27 '21 13:04 mosteo

Here's the "alr -vv -d edit" command's output trace and config.toml from my @HOMEDIR.config\alire\ folder.

investigation_data.zip

heharkon avatar Apr 27 '21 15:04 heharkon

Thanks, @heharkon.

mosteo avatar Apr 27 '21 15:04 mosteo

I think it depends on region, but UTF-8 support on Windows is still in beta, but can be enabled. I don't have this enabled and it defaults to IBM437 as described in a progress_indicators ticket. I suspect the console input needs to be set with SetConsoleCP to an more appropriate code page (like CP_UTF8). @heharkon , what does chcp say when you run it in console?

pyjarrett avatar Jun 19 '21 14:06 pyjarrett

Hi!

It says:

C:\Users\hehar>chcp Active code page: 850

heharkon avatar Jun 19 '21 18:06 heharkon