Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5966407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:47:45+00:00 2026-05-22T19:47:45+00:00

How do I port characters expressed as decimals (#0, #1, #9, #10, #13, #32,

  • 0

How do I port characters expressed as decimals (#0, #1, #9, #10, #13, #32, #128, #255) in Delphi 7 to Delphi Unicode? Some documents (such as ‘Delphi in a Unicode world’ from Embarcadero) only says that they should be replaced with the actual character. For example instead of #128 I should use ‘€’. But what would you do with #0??? Or #9? Or #13?


Update:

It looks like this is a tricky question. Somebody stated here that all chars under 128 remain unchanged. However, ‘Delphi in a Unicode world’ states otherwise. So, there is a way to use something like #9 in Delphi XE or porting the code from Delphi 7 to Delphi Unicode involves massive code changes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:47:46+00:00Added an answer on May 22, 2026 at 7:47 pm

    The low half of ANSI codes [#0..#127] does not change after conversion to Unicode, so you should not bother about it. The high half [#128..#255] is more complicated. The compiler interprets lines

    const s1:AnsiString = #200;
    const s2:UnicodeString = #200;
    

    depending on {$HIGHCHARUNICODE} directive

    {$HIGHCHARUNICODE OFF}          // default setting on Delphi 2009
    const s1:AnsiString = #200;     // Ord(s1[1]) = $C8 = 200
    const s2:UnicodeString = #200;  // Ord(s2[1]) depends on Codepage
                                    //  on my Win1251 = $418  
    
    {$HIGHCHARUNICODE ON}
    const s1:AnsiString = #200;     // Ord(s1[1]) depends on Codepage
                                    //   on my Win1251 = $45
    const s2:UnicodeString = #200;  // Ord(s2[1]) = $C8 = 200
    

    #200 is ‘И’ on Win1251 codepage. The Unicode codepoint for ‘И’ is $418.

    On the other hand, in Unicode #200 is ‘È’. Win1251 does not have ‘È’ character and Unicode -> Win1251 conversion transforms it to ‘E’ which is #$45 for all ANSI codepages.

    With {$HIGHCHARUNICODE OFF} the compiler interprets #128..#255 characters as ANSI characters depending on system codepage and, if necessary, converts them to unicode codepoints.

    With {$HIGHCHARUNICODE ON} the compiler interprets #128..#255 characters as Unicode codepoints and, if necessary, converts them to ANSI characters with possible loss.


    Update

    I see now the problem code from the Nick’s article that works wrong on Unicode Delphi:

    var
      Buf: array[0..32] of Char;
    begin
      FillChar(Buf, Length(Buf), #9);
      ShowMessage(Format('%d %d %d', [Ord(Buf[0]), Ord(Buf[0]), Ord(Buf[16])]));
    end;
    

    but that is an example of wrong FillChar procedure usage; FillChar just fills the destination buffer with bytes (BTW only the first half of Buf in the above example) and ignores all the new Unicode stuff. FillChar should be renamed by FillBytes now, and forbidden to use a character (#9) for the third argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a TMemo to hold received characters from a serial port for
I am reading from serial port using string messaga = _serialPort.ReadLine(); When i Console.WriteLine(messaga);
I have a very simple terminal application that sens and receives characters from a
We're using the read() method from unistd.h to receive data from the serial port
I'm using JavaComm, and getting the inputStream from the serial port object. I have
I'm currently trying to port some OCaml to F#. I'm in at the deep
I need to insert some strings containing non ASCII characters into the database (Postgress).
I am using async_read_some to read data from a port that is saved in
I am trying to print Chinese characters on an Epson TM-T88IV M (parallel port)
I have been doing overlapped serial port communication in Delphi lately and there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.