[Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

Michael Van Canneyt michael at freepascal.org
Fri May 5 11:27:29 CEST 2017



On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote:

> On 2017-05-05 10:17, Michael Van Canneyt via Lazarus wrote:
>>> Something like: 
>>>
>>>  sl.LoadFromFile('some_utf8_file.txt', CP_UTF8);
>>>  sl.LoadFromFile('some_utf16_file.txt', CP_UTF16);
>>>  sl.LoadFromFile('some_latin1_file.txt', CP_Latin1);
>>
>> Not yet. These are the exceptions I was talking about.
>
>
> That also means FPC 3.0.x is then seriously flawed. It
> supports Unicode, but it also doesn't support Unicode.
>
> So what is the suggested work-around for FPC 3.0.2 to load
> various text encoding files into a TStringList? Hopefully
> the answer is not: "there is none"  :-/

Use the plain pascal routines to read lines from a file, 
fill stringlist. You can write a class helper for it.

> Because that will seriously impair/break INI usage too. The
> first example off the top of my head. XML and JSON probably
> too.

No. Those have been using widestring/UTF8string since day 1.

The main problem to switch the classes unit is backwards compatibility.

Michael.


More information about the Lazarus mailing list