Sven Barth wrote:

> You need to convert the UTF8 string to a different one, e.g.
> UTF16:
> 
> var
>    us: UnicodeString;
> begin
>    us := UTF8Encode(s);
> end;
> 
> Now us[2] will return the a-umlaut.

I would suggest using Utf8Copy(s, 2, 1) instead. It helps
to avoid conversion and works correctly even for characters
that take 4 bytes in UnicodeString/WideString (i.e. 2
wide characters). Utf8Copy is declared in LCLProc unit.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to