Handling a Unicode String in Delphi Versions <= 2007

前端 未结 5 1795
日久生厌
日久生厌 2020-11-30 03:40

Background: This question relates to versions of Delphi below 2009 (ie without Unicode support built in). I have a specification that requires me to transmi

5条回答
  •  天命终不由人
    2020-11-30 04:18

    Converting a pre-Delphi 2009 application to unicode is difficult but doable. I'd split it up into 3 tasks.

    1. First, make sure your database handles unicode strings. Preferably UTF-16 support. Make sure all your database code handles widestrings correctly, and the drivers you are using handle this ok too.
    2. Convert all your business logic from using strings to using WideStrings. It's very easy to miss some, and you won't get any errors, as the compiler will implicitly convert widestring to string if you forget any methods. Also make sure you change all standard string functions to WideString equivalents. This process needs to extend to any thrid part components you may use.
    3. Final part is to change the standard and third party visual components you may have to WideString equivalents. This needs to be done where ever you'll be displaying strings which may contain unicode characters.

    On top of all that make sure your testing is thorough, and uses unicode characters which actually use the high byte. If you just test using the latin character set, you will miss bugs.

提交回复
热议问题