Planning upgrading from D2007 to XE, but want to read up on issues I will need to consider first to do with strings becoming Unicode by default. I recall the release of D2009 came with good white papers explaining ramifications, however I haven’t seen these as I haven’t upgraded. Asked for such also at the XE event but have not been sent anything yet.
I have a lot of code which I want to plan to be able to recompile easily, and would like to plan this migration. I would prefer to put anything contentious or varying into a library unit, a ‘wrapper’ so that I don’t have to deal with these version differences in the main code... Anyone can answer any of these quick questions please post here or email me – thanks! Q1 - Anyone got some good references to read up on ansistring to unicode issues ? Comprehensive please! Q2 – With XE do the .pas and .dfm files become unicode text and hence cannot be read by earlier Delphi, eg D2007 any more? Q3 – I do a lot of reading ascii data files, and writing back. Using mainly TFilestream and stringlists. Does this in general mean I will need to use file variables declared as Ansichar and AnsiString instead of Char and String? (I would prefer to use the standard VCL where possible) If I have variables as1:Ansistring; s2:string; Q4 – if I do s2:=as1 does this convert ansistrings to unicode? Q5 – if I do as1:=s2 does this convert a unicode string to ansstring? (otherwise how do I do this?) Q6 – I understand any code like char1:=string1[i]; if char1 in [‘a’..’z’] then begin message:=string[i]+’ - character is lowercase’; end will break, as ansi characters are ordinal (less than 256 or 512) and set comparisons ['a'..'z'] or ['a','b','c'] can be used, this set code cannot be used for unicode characters. What is the replacement? Q7 – do literals like #13#10 still mean carriage return and linefeed? #9 means tab? if I have code like (logline string1 string2 are string) logline:=FormatDateTime(‘dd-mmm-yyyy hh:nn:ss’,now) + string1 + #13#10+#9 + string2; ShowMessage(logline); Button1.hint:=logline; writeln(f,logline); these work D5-D2007 - ie a 2 line messagebox text, 2 line hint, and 2 lines written to a log file. is this still going to work? do carriage returns/tabs/other control characters have to be defined differently, eg as constants? Q8 – stringlist1.loadfromfile(‘Test1.txt’); what happens if this file is ascii text being read into a stringlist which is unicode strings. Q9 - stringlist1.savetofile(‘Test1.txt’) presumably this is no longer ascii text. How do I save and read a stringlist to/from a file if it is to be Ansi text? Q10 – If there are complexities in Q8 and Q9 is there a TAnsiStringlist type (for ansistrings) as well as a unicode TStringlist type? (I use stringlists a lot) Q11 – do inifiles become unicode too? Q12 – does Windows Notepad open unicode text files correctly? or can it only be used on Ansi text files? Q13 - It looks like most programmers editors read and write ascii and unicode encoding.....the one I use seems to distinguish between UTF-8 and unicode as well – what is the difference? John _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe