Computer Hope

Software => Computer programming => Topic started by: BatchProgrammer on January 24, 2016, 07:46:19 PM

Title: [Batch] How to echo Unicode Characters
Post by: BatchProgrammer on January 24, 2016, 07:46:19 PM
No matter what I do, I can't figure out how to echo this character: █
In cmd I can easily put them with Alt+219.
But in my batch program it shows like this Ôûê
Its strange because I can print this character: ►
I tried with many code pages and I tried to set the character set on my editor to OEM-US or OEM-850, and it does nothing...
Any suggestions?
Title: Re: [Batch] How to echo Unicode Characters
Post by: Geek-9pm on January 24, 2016, 09:35:10 PM
Do you wish to show Unicode or extended ASCII?
The ASCII has to be defined by a page code.
But  Unicode is not really the same thing.

https://en.wikipedia.org/wiki/Code_page_437
https://en.wikipedia.org/wiki/Extended_ASCII

Notice that these two references in the wiki have some issues. They sought to be combined and unified to make things clear.

But Unicode is another monster. A 16 bit value is used to represent fonts that are way outside of what you could do with code pages. The Chinese set can have thousands of basic symbols used in Chinese documents. Japanese is similar, but different.
https://en.wikipedia.org/wiki/Unicode

So I shall suppose what  you really want ot use some kind of extended ASCII.  Be  sure your DOS system has the code page you want. Do not suppose that Windows is using the same code page. Even if it is.
See here:
http://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8
And here:
http://www.computerhope.com/chcphlp.htm

Quote
About chcp
Before the chcp command can be used, the nlsfunc must be loaded, as well as the country.sys must be loaded into the config.sys.
The chcp command is used to supplement the international keyboard and character set information, allowing MS-DOS to be used in other countries and with different languages.
You need to use MS-DOS 6.22 and above for the chcp command. Note you have to decide what country you want. And then, there are some more variations.

Don't  want to chide you, but please do not confuse ASCII with Unicode.  :)