How to? how can I use Cyrillic characters in the Echo command?

#1
Hello All!

Can I use the Cyrillic characters? I tried look into this matter. See the attached file (cyrillic.btm).
Cyrillic characters are displayed in tcc and tcmd differently.
See the attached files (tcc.png and tcmd.png).
Why is this happening?

Thank you

p.s. Where the values of options UnicodeOutput and UTF8 have not given effect.
 

Attachments

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,703
47
Albuquerque, NM
prospero.unm.edu
#4
Okay, so you can display Cyrillic characters. I think the real question is, what is the best way to embed these characters in a batch file?

My personal opinion: Use Unicode. Save your batch file as UTF-16. That way there's no question what letter each value represents. You're doubtless aware that there are at least three different, mutually incompatible 8-bit encodings for Cyrillic. UTF-16 does come with a size penalty, but in my opinion the certainly of getting the right character more than makes up for it.

Every time I bump into code pages, I hate them a little bit more.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,703
47
Albuquerque, NM
prospero.unm.edu
#6
...and the characters from a batch file are displayed correctly also.
Code:
echo 0x  %@char[0x410 0x411 0x412 0x413 0x430 0x431 0x432 0x433]
Yeah. TCC uses Unicode internally. If you aren't redirecting to a file, then code pages are irrelevant. If your font(s) have the correct characters, that command should always work. (If it did not work, then I would know you had a font problem.)
 
#7
Okay, so you can display Cyrillic characters. I think the real question is, what is the best way to embed these characters in a batch file?

My personal opinion: Use Unicode. Save your batch file as UTF-16. That way there's no question what letter each value represents. You're doubtless aware that there are at least three different, mutually incompatible 8-bit encodings for Cyrillic. UTF-16 does come with a size penalty, but in my opinion the certainly of getting the right character more than makes up for it.

Every time I bump into code pages, I hate them a little bit more.
:smile: Oh, yes - I know what you mean.

The first two text editors that I know do not allow me to save text in the encoding UTF-16.
You reminded me that I can use %@char[ 0xNNN ] function, at least.

Thank you
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,703
47
Albuquerque, NM
prospero.unm.edu
#8
:smile: Oh, yes - I know what you mean.

The first two text editors that I know do not allow me to save text in the encoding UTF-16.
Notepad will do UTF-16. It's pretty pathetic editor, but it can save as UTF-16 (and UTF-8 and UTF-16 big-endian, neither of which TCC understands.) Most modern text editors can also do it. I frequently use "Crimson Editor", which is old, peculiar, and unsupported -- but does UTF-16. There are many others.
 
#9
Yes, the "Crimson Editor" is a good editor. While editing there is option to set code page.
Too in both editors that I know, I found an option to save a text as UTF-16.
1. In "Far Manager" is simple editor F4. That to create new file as UTF-16 you need to press Shift-F4 and to select the code page. (See create-utf16-text-in-FAR.PNG).
2. Also in "UEStudio" is the option, but only while saving.
3. Yeah. Notepad ... aslo while saving :-)

The ECHO command in a .btm file as UTF-16 is working correctly !
But a text should be not big-endian and little-endian only.
And the TYPE command displays correctly text files as UTF-16 (little-endian) for both code pages 866 and 1251.

Today is nice day! I learned a lot.:smile:

Thank you so much!
I wish Merry Christmas to you, Rex Conn, and members of the forum :happy:
 

Attachments

Last edited: