[fpc-devel] Unicode support - for the 20th time... ;-)
Florian Klaempfl
florian at freepascal.org
Thu Nov 20 10:12:34 CET 2008
Graeme Geldenhuys schrieb:
> Hello again,
>
> We are seeing more and more "hacks" being applied to projects trying
> to scramble around the missing FPC feature - no built-in Unicode
> supporting.
>
> A simple example in Lazarus.... Loading a UTF-8 encoded file into a TMemo.
>
> Normally you would write code as follows (for ANSI text):
>
> Memo1.Lines.LoadFromFile('someunicodefile.txt');
>
>
> Unfortunately that doesn't work if the file contains unicode content,
> so the following "hack" is required which is quite nasty:
>
> ls := TStringList.Create;
> ls.LoadFromFile('someunicodefile.txt');
> for i := 0 to ls.Count-1 do
> ls[i] := UTF8Encode(ls[i]);
> Memo.Lines.Assign(ls);
> ls.Free
>
> I'm also pretty sure I am not the only one that is willing to help
> with this feature - many developers require Unicode support. And this
> is just going to become more urgent as time goes by. So lets finalize
> a design and start implementation. Pretty please. ;-)
>
Ok, two questions for the example above:
- how do you maintain backward compatibility?
- how do you load a plain old ansi file?
More information about the fpc-devel
mailing list