On 05 Nov 2012, at 11:49, ik wrote:

As I understand, AnsiString and AnsiChar contain the environment type
of string (it can be ISO8859x, utf-8 etc...).
If that so, how can I know the size (in bytes) of AnsiChar ?

The size of the type "AnsiChar" is always one byte. It is impossible to give the size of a generic "character" in a 1-byte string, because in e.g. UTF-8 the size depends on the code point. To get the size of a specific character, you can use
  widestringmanager.codepointlengthproc(pchar,maxlookahead)

"maxlookahead" is the maximum number of bytes that routine is allowed to check to find the complete character (e.g. "widestringmanager .codepointlengthproc(@ansistringvar[3],length(ansistringvar)-2)"). It seems this routine has not yet been implemented for the Windows widestringmanager though.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to