[fpc-devel] Changing Windows API A routines in SysUtils to W in Windows NT
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Tue Feb 7 18:01:30 CET 2012
Hello,
Here is a second version of the patch. I think it is better then my
first one because it will not make a conversion for legacy
applications (they don't need it anyway) and it will only improve the
UTF-8 handling in the Ansi RTL which already partially exists in
SetMultiByteConversionCodePage.
I tested that it works correctly with a LCL application like this:
procedure TForm1.Button1Click(Sender: TObject);
var
lStrings: TStringList;
begin
SetMultiByteConversionCodePage(CP_UTF8);
lStrings := TStringList.Create;
lStrings.SaveToFile(Edit1.Text);
lStrings.Free;
end;
http://img404.imageshack.us/img404/5478/lazarusutf81.png
And the best of all! It is not mandatory! If you like the old behavior
just write like this:
procedure TForm1.Button1Click(Sender: TObject);
var
lStrings: TStringList;
begin
//SetMultiByteConversionCodePage(CP_UTF8);
lStrings := TStringList.Create;
lStrings.SaveToFile(Edit1.Text);
lStrings.Free;
end;
And it works exactly like before (which means it will generate a wrong
filename in this case).
So here we are: 10 lines of code away from having TStringList finally
work with full Unicode support and with full integration with Lazarus.
How many lines of code till a perfect integration of the RTL with
Lazarus, a perfect UTF-8 support in the RTL? Maybe 100? Hardly a
terrible maintenance burdain.
Will we be able to close the division among us as get our 10 lines of
code going and benefit hundreds of thousands of Lazarus users? Or are
these 10 lines of code a major treat to the universe as we know it?
Stay tunned for the next chapters of the Unicode wars =)
--
Felipe Monteiro de Carvalho
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicodesysutils.diff
Type: application/octet-stream
Size: 1665 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120207/53ab544f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: created_utf8_file.PNG
Type: image/png
Size: 3156 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120207/53ab544f/attachment.png>
More information about the fpc-devel
mailing list