On Thu, Nov 20, 2008 at 10:06, Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > > 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've used this ""hack"" in my projects so far (both FPC and C++), it works really well, and I don't have a bit of problem with it. The simple rules I use is: - all internal strings in a project must be in UTF-8 (which I used) - all localized strings are written in external files, never inside the code - encoding/decoding is done in three situations: 1) before/after I/O operations (where I know/force encoding and format of files I use) 2) before/after system calls (if neccessary) 3) in several and well-defined places in GUI As far as I can see, Lazarus team made similar decisions. Yes, this ab-uses AnsiString, but it works, and it works really well :-) As of Unicode future inside FPC, after reading Marco's document, I'm sure FPC will be compiler with superb support for Unicode (both compiler- and RTL-side). Greets, Aleksa _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel