Re: [fpc-pascal] UnicodeString and Length() function

2016-03-25 Thread Graeme Geldenhuys
On 2016-03-25 19:26, Jonas Maebe wrote: > It returns the number of ansi/widechars. In case of ansichars, that > equals the number of bytes. Ah, not bytes, so Length returns the number of elements [like in an array]. Thanks for clearing that up. Regards, - Graeme -

Re: [fpc-pascal] UnicodeString and Length() function

2016-03-25 Thread Jonas Maebe
On 25/03/16 20:21, Graeme Geldenhuys wrote: Length() returns the number of bytes, correct? It returns the number of ansi/widechars. In case of ansichars, that equals the number of bytes. So why isn't the result 8 and 14? The letter o with acute is 2-bytes in UTF8 ($C3 & $B4). That depend

[fpc-pascal] UnicodeString and Length() function

2016-03-25 Thread Graeme Geldenhuys
I never really used the UnicodeString (or WideString for that matter) - I've always used AnsiString with UTF-8 content. I also have my own UTF8 functions Copy(), Length() etc. Looking at UnicodeString - with FPC 2.6.4 I seem a bit confused. :-/ Take the following code: =