1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Support' started by Alexander, Dec 27, 2014.

  1. Alexander

    Joined:
    Jan 29, 2012
    Messages:
    16
    Likes Received:
    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.
     

    Attached Files:

  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    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]
    
     
  3. Alexander

    Joined:
    Jan 29, 2012
    Messages:
    16
    Likes Received:
    0
    Lucida Console (14) cyrillic.
    Characters (uppercase and lowercase) are displayed correctly.

    /wnr, Alexander
     

    Attached Files:

    #3 Alexander, Dec 27, 2014
    Last edited: Dec 27, 2014
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    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.
     
  5. Alexander

    Joined:
    Jan 29, 2012
    Messages:
    16
    Likes Received:
    0
    ...and the characters from a batch file are displayed correctly also.
    Code:
    echo 0x  %@char[0x410 0x411 0x412 0x413 0x430 0x431 0x432 0x433]
    
     

    Attached Files:

  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    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. Alexander

    Joined:
    Jan 29, 2012
    Messages:
    16
    Likes Received:
    0
    :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
     
  8. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    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. Alexander

    Joined:
    Jan 29, 2012
    Messages:
    16
    Likes Received:
    0
    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:
     

    Attached Files:

    #9 Alexander, Dec 28, 2014
    Last edited: Dec 29, 2014

Share This Page