Tuesday, May 24, 2011

Edit and display local characters in .bat scripts

Problem: Sometimes I need to write a batch script echoing instructions in my native language Norwegian, including its special characters æ, ø and å. The only thing is, if you edit the .bat or .cmd file in Notepad, it will translate into garbled characters because of an character encoding issue.

Solution: With my favorite plain text editor, the free Notepad++, I have the possibility of selecting encoding for the file I am editing. Menu item Encoding-Character sets-Western European-OEM 850 works well for the Norwegian special characters, and possibly others.