[fpc-devel] Unicode resource strings

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Aug 21 16:44:54 CEST 2012


On Tue, 21 Aug 2012 15:11:56 +0100
Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:

> On 21 August 2012 14:54, Marco van de Voort <marcov at stack.nl> wrote:
> >
> > Doesn't sound wise.  length(stringtype)=n should mean that the string takes
> > sizeof(char)*n bytes. (give or take the #0#0)
> 
> 
> I'm not sure what you are trying to accomplish? Give me sample code
> that will cause a problem.
> 
> In fpGUI I have UTF8Length(mystring) which returns the actual number
> of code points used - not bytes used. If you want the number of bytes
> used, simply use Length(mystring).  Use each of those at appropriate
> times based on what you want to accomplish.

length returns the number of characters.
UTF8Length the number of codepoints.
There must also be a function to return the number of bytes.
Does someone know the name?

 
> The RTL Length() function has been the source of lots of confusion to
> Delphi and FPC developers. So without an actual use-case I don't know
> what you are trying to do.


Mattias



More information about the fpc-devel mailing list