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

Ondrej Pokorny lazarus at kluug.net
Fri May 5 11:24:31 CEST 2017


On 05.05.2017 11:17, Michael Van Canneyt via Lazarus wrote:
> On Fri, 5 May 2017, Graeme Geldenhuys via Lazarus wrote:
>
>> On 2017-05-05 07:43, Michael Van Canneyt via Lazarus wrote:
>>> As far as I know, you don't need any tricks to work with unicode
>>> filenames or output in 3.0.2. Maybe with exception of TStrings and
>>> TFileStream.
>>
>> Again, I didn't have time to follow FPC 3.x development much, and I 
>> was too
>> confused with all the Unicode changes.
>>
>> With FPC 3.0.x, can you now load text files from disk using 
>> TStringList and
>> specify the encoding of the file at load time?
>>
>> 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.

Current trunk 3.1.1 can do that since r34475 - you applied it :) I don't 
know if you ported it back to 3.0.x, though.

TFileStream can also open files with unicode names - at least on Windows 
(since 3.0.0 if I am not mistaken). See

Function FileCreate (Const FileName : UnicodeString; ShareMode : 
Integer; Rights : Integer) : THandle;

in rtl/win/sysutils.pas

-->> There are absolutely no limitations whatsover, AFAIK. At least I 
don't know any and I don't experience any.

Ondrej


More information about the Lazarus mailing list