On 18.02.2011 15:57, Graeme Geldenhuys wrote:
Op 2011-02-18 14:19, Hans-Peter Diettrich het geskryf:
Also implied conversions may not be noticeable to many users, and this
also may apply to a future FPC/Lazarus model.
I've lately had a renewed interest in working on the Unicode for FPC, so
have been silently hammering away at the code in my [limited] spare
time. If all goes to plan, the change-over should be relatively
painless, and more intuitive than Delphi's was. This should also mean
that projects like Lazarus LCL, fpGUI and MSEgui could essentially
switch to simply using the String type instead of custom types like
TfpgString or TMSEString etc., and removing special UTF8* string
functions and replacing them with standard RTL ones. I guess fpGUI will
be the first test case on how successful such a string change-over will
be. :)
The good news is [or at least that is my plan], is that if LCL, fpGUI
and MSEgui still want to use a hard-coded internal string encoding, that
should be simple to accomplish - via something like the following. eg:
for fpGUI it could be...
type
TfpgString = String<cp_utf8>; //<-- this should be the only change.
var
MyString: TfpgString; // this code is as it always was
Introducing a method that could set the default global encoding for
String type (ignoring the OS platform) is also in the plans. I believe
Delphi can do this too.
When you're still working on that branch (you got it to compile again?)
it might indeed be that you fullfill Florian's point of "those who
implement it decide how it's done" (more or less).
I just got an idea: What about using a more sane way of the Unicode
string feature in mode (Obj)FPC (like you're trying to implement,
Graeme), keeping the old way in mode Delphi (String = "RawByteString")
and introduce a new mode Delphi2009 that tries to be compatible with
Delphi's Code Page aware string type. Or maybe instead of a new mode
better add a modeswitch "DelphiCPAwareStrings" (or something like
this...) that needs to be enabled for code that should be compatible to
Delphi 2009. Thus users of pre-Delphi2009 could be happy, too.
And yes, I'm aware that this means work. ;)
Just my 2 cents...
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus