[Lazarus] How to use strings properly with fixes_1_6 and FPC 3.0.0?
Juha Manninen
juha.manninen62 at gmail.com
Fri Oct 21 12:38:25 CEST 2016
On Fri, Oct 21, 2016 at 1:05 PM, Gabor Boros via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> 2016. 10. 21. 10:25 keltezéssel, Juha Manninen via Lazarus írta:
> I read, I read but if contains buggy example... ;-)
Mattias fixed the bug.
> I need a quick and a rock solid solution. Is it good solution if replace all
> Length, Copy, Delete with UTF8Length, UTF8Copy, UTF8Delete and read the
> strings through with this for i:=1 to UTF8Length(s) do
> Write(UTF8Copy(s,i,1))?
No, it not a good solution!
I predict that most your code can still use byte indexing. At some
point you will get a Heureka-moment like "hey, I don't need the
codepoint index when doing this task!".
> I do not want to think of where Length, Copy, Delete is good and where UTF8*
> needed.
Well, you must think when coding. There is no shortcut. :)
BTW, if you are worried about Delphi compatibility there is now unit
LazUnicode available.
See:
http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus#CodePoint_functions_for_encoding_agnostic_code
Juha
More information about the Lazarus
mailing list