Author Topic: Code pages and batch files - fun with XP  (Read 149 times)


  • Member
  • *****
  • Posts: 7460
  • Assembler is fun ;-)
    • MasmBasic
Code pages and batch files - fun with XP
« on: May 29, 2017, 11:45:31 AM »
Code: [Select]
@echo off
echo Hello, we will try now to change the codepage to 850:
chcp 850
echo Wow, that worked! Now we'll try 1252:
chcp 1252
echo Wow, that worked also! But what about UTF-8?
chcp 65001

echo congrats!

Looks straightforward, right? But it isn't... try it with XP. From a DOS prompt, please, because it will never reach the "congrats" 8)

I stumbled over this Windows bug because RichMasm had stopped working in XP. It took me quite a while to spot this exotic behaviour, now it's fixed with a switch for XP :bgrin:

P.S.: This bug affects Windows 2003 as well, see batch stops on command "chcp 65001 >NUL" - Windows2003; the suggestion to use chcp 65001 > nul && <real command here> does not work.
« Last Edit: May 29, 2017, 07:01:32 PM by jj2007 »