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

Jan 29, 2012
16
0
Russia, Novosibirsk
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: 177
  • tcmd.png
    tcmd.png
    19.8 KB · Views: 204
  • cyrillic.btm
    321 bytes · Views: 93
Jan 29, 2012
16
0
Russia, Novosibirsk
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: 133
  • font_of_options.PNG
    font_of_options.PNG
    53.1 KB · Views: 141
  • font_tcc.PNG
    font_tcc.PNG
    43.8 KB · Views: 119
Last edited:

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
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.
 
Jan 29, 2012
16
0
Russia, Novosibirsk
...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: 125

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
...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.)
 
Jan 29, 2012
16
0
Russia, Novosibirsk
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
4,461
88
Albuquerque, NM
prospero.unm.edu
: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.
 
Jan 29, 2012
16
0
Russia, Novosibirsk
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: 194
Last edited:
Similar threads
Thread starter Title Forum Replies Date
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
WinLanEm Read Cyrillic text from a file Support 12
R WAD Unusable state when using Chinese characters Support 3
C TEE command appending null characters to output Support 6
D Regexes and escape characters Support 5
vefatica Quoting file names with special characters? Support 7
vefatica How to? Add real <ESC> characters with TPIPE Support 2
C Erase all characters left or right from cursor location Support 2
J Escaped Characters and Variables Support 2
Joe Caverly Unicode, Codepage 437, and line characters Support 3
gschizas Fixed Using codepage 65001 (UTF-8) breaks non-ASCII characters Support 8
vefatica Display of special characters in aliases. Support 25
J Python: TCC command line parsing removes '=' equal sign characters Support 4
C filemasks over 172 characters fail Support 5
redwdc TCC.exe opens to 11 characters x 3 rows Support 1
G Selection characters with mouse double-click Support 3
R Function #IDOW returns only 2 characters Support 10
krischik WAD Tee printing Chinese characters Support 7
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
V Fixed CD ~ has trash characters in it Support 5
S International characters - TYPE vs %@LINE function Support 5
Jay Sage Getting Quote Characters into a Toolbar Tab Support 12
vefatica Fixed Escaping special characters Support 1
M Problem with Extended Search and non-ASCII characters in directories names Support 3
A How to? PhraseExpress autotext/autocompletion printing unexpected characters Support 4
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
JohnQSmith WAD DO and escaped redirect characters Support 6
W TCMD 16: double characters Support 11
MickeyF how to work with env var with special characters in the name Support 5
vefatica Fixed TPIPE doesn't /SPLIT at characters Support 0
A Escape characters on right side of pipe Support 0
J How to? 'tab' characters in the console and clipboard 'copy' Support 1
M How to? Determine a whether vars beginning with certain characters exist... Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
U Keystack mangles 'special' characters Support 6
J dir failure with some unicode characters Support 6
vefatica Random access to the characters in a string? Support 4
nikbackm @select function and TAB characters Support 1
M Overriding meanings of some characters... Support 7
T How do you echo lines with special characters to file? Support 4
Emilio III Control characters pass through? Support 6
S Strange REN problem - non-English characters Support 3
nikbackm Output of non-ascii characters via pipe Support 1
K Processing strings with % characters? Support 2
W Bugs in dealing with Chinese characters? Support 0
fpefpe How to? command echo in title line/bar Support 2
vefatica @EXECSTR clobbers @ECHO ON Support 2
L WAD ECHO. expansion of non-existent env-vars differs from CMD.exe Support 6
D Does TCC improve CMD's implementation of ECHO? Support 6
E My echo full file name to the clipboard fails now. Support 2

Similar threads