How do the new string types work in Delphi 2009/2010?

前端 未结 5 750
我在风中等你
我在风中等你 2020-12-24 03:51

I have to convert a large legacy application to Delphi 2009 which uses strings, AnsiStrings, WideStrings and UTF8 data all over the place and I have a hard time to understan

5条回答
  •  青春惊慌失措
    2020-12-24 04:50

    Watch my CodeRage 4 talk on "Using Unicode and Other Encodings in your Programs" this friday, or wait until the replay of it is available online.

    I'm going to cover some encodings and explain about the string format.

    The slides will be available shortly (I'll try to get them online today) and contain a lot of references to stuff you should read on the internet (but I must admit I forgot the link to Joel on Unicode that eed3si9n posted).

    Will edit this answer today with the uploads and the links.


    Edit:

    If you have a small sample where you can show that your C/C++ DLL receives the strings UTF8 encoded, but thought they should be encoded otherwise, please post it (mail me; almost anything at the pluimers dot com gets to me, especially if you use my first name before the at sign).

    Session materials can be downloaded now, including the "Using Unicode and Other Encodings in your Programs" session.

    These are links from that session:

    Read these:

    1. Marco Cantu, Whitepaper “Delphi and Unicode”
    2. Marco Cantu, Presentation “Delphi and Unicode”
    3. Nick Hodges, Whitepaper “Delphi in a Unicode World”

    Relevant on-line help topics:

    1. What's New in Delphi and C++Builder 2009
    2. String Types: Base: ShortString, AnsiString, WideString, UnicodeString
    3. String Types: Unicode (including internal memory layouts of the string types)
    4. String Types: Enabling for Unicode
    5. String Types: RawByteString (AnsiString with CodePage $ffff)
    6. String Types: UTF8String (AnsiString with CodePage 65001)
    7. String <-> PChar conversions: PChar fundamentals
    8. String <-> PChar conversions: Returning a PChar Local Variable
    9. String <-> PChar conversions: Passing a Local Variable as a PChar

    Hope this gets you going. If not, mail me and I'll try to extend the answer here.

提交回复
热议问题