Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

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

Jan
16
0
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

  • tcc.png
    tcc.png
    10.6 KB · Views: 544
  • tcmd.png
    tcmd.png
    19.8 KB · Views: 612
  • cyrillic.btm
    321 bytes · Views: 272
Which font are you using? (Options / Take Command / Tabs / Font)

What do you see if you do:
Code:
echo %@char[0x410 0x411 0x412 0x413 0x430 0x431 0x432 0x433]
 
Lucida Console (14) cyrillic.
Characters (uppercase and lowercase) are displayed correctly.

/wnr, Alexander
 

Attachments

  • tcmd_tcc_chars.png
    tcmd_tcc_chars.png
    42.6 KB · Views: 456
  • font_of_options.PNG
    font_of_options.PNG
    53.1 KB · Views: 475
  • font_tcc.PNG
    font_tcc.PNG
    43.8 KB · Views: 432
Last edited:
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.
 
...and the characters from a batch file are displayed correctly also.
Code:
echo 0x  %@char[0x410 0x411 0x412 0x413 0x430 0x431 0x432 0x433]
 

Attachments

  • tcmd_echo_0x.png
    tcmd_echo_0x.png
    14 KB · Views: 441
...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.)
 
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
 
: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.
 
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

  • create-utf16-text-in-FAR.PNG
    create-utf16-text-in-FAR.PNG
    62.8 KB · Views: 585
Last edited:

Similar threads

Back
Top