Question

We have to upgrade to XE2 (from Delphi6).

I collected many informations about this, but one of them isn't clear for me.

We are using String - what is AnsiString in XE.

As I know we must replace all (P)Ansi[String/Char] in our libraries to avoid the side effects of Unicode converts, and to we can compile our projects.

It is ok, but we are also using TStringList, and I don't found any TAnsiStringList class to change it simply... ;-)

What do you know about this? Can this cause problems too? Or this class have an option to preserve the strings?

(Ok, it seems to be 3 questions, but it is one only)

The program / OS language is hungarian, the charset is WIN-1250, what have some strange characters, like Ő, and Ű...

Thanks for your every information, link, etc.

Was it helpful?

Solution

1) 1st of all - WHY should u use AnsiStringList, rather than converting all your project to unicode-aware TStringList ? That should have certain detailed reasons, to suggest viable alternatives.

Unicode is a superset of windows-1250, windows-1251 and such. Normally all you locale-specific string would be just losslessly converted to Unicode. IT is the opposite, Unicode to AnsiString, convertion that may loose data. Explicit or implicit (like AnsiChar reduction in "if char-var in char-set")

You may have type-unsafe API like in DLLs, where compiler cannot check if you pass PChar or PAnsiChar, but you anyway should not pass objects liek TStrings into DLLs, there are BPLs for that.

So you probably just do not need TAnsiStringList

2) you can take TJclAnsiStringList from Jedi Code Library

3) You can use XE2 stock TList<AnsiString> type

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top