3
1
I recently tried to explain to a friend how to create a simple one-line batch file:
subst t: "X:\Example"
On my machine that has been working fine for years, but on theirs I ran into an issue: their name contained non-ASCII characters (the turkish characters ı and ç to be exact) which weren't recognized properly.
The simple solution to this that I would be to add
chcp 65001
at the top of the file to change the active codepage to the UTF-8 one.
But this didn't work. On their computer this caused a crash of the command shell that was executing it. I made them try a few different values; 65000 crashed but 10000 didn't and all values below that which I tried worked as well, but did not correspond to the same code pages as the same values on my computer. Their default code page was different as well (857 instead of 850 as on my computer. This makes sense as, according to MSDN, 857 is a turkish code page and 850 a western european one).
I know that some code pages can change from computer to computer, but the MSDN page explicitly states that one should use UTF-8 because the other pages may change (altough there is a distressing lack of documentation regarding how and when they change).
Is that false? Can the value of 65001 change as well? If so, why would that cause a crash? Shouldn't it complain about "Invalid code page" at worst? And if it does change, how can one find out which value to use to get it or how else could I get it to accept non-ASCII characters?
I am using windows 10 with the english language (it came preinstalled with windows 8.1 italian) while my friend uses windows 7 turkish.
at the top of the file
Did you save the batch file with UTF-8 encoding? – dxiv – 2016-08-27T04:55:52.437@dxiv yes, I did (and made sure my friend did as well) – Annonymus – 2016-08-27T06:33:57.383