The MASM Forum

Miscellaneous => The Orphanage => Topic started by: jj2007 on May 29, 2017, 11:45:31 AM

Title: Code pages and batch files - fun with XP
Post by: jj2007 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 (!topic/alt.msdos.batch.nt/m1TXE5mLvzo); the suggestion to use chcp 65001 > nul && <real command here> ( does not work.