[fpc-pascal] Char, WideChar, String and WideString in FPC/Lazarus

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jul 6 16:40:54 CEST 2006


On 6 jul 2006, at 16:29, Borut Maricic wrote:

> What is the exact definition of the type Char and String in FPC?

A char is a 1 byte value which can contain the values chr(0) till chr 
(255). A (short)string is a length byte followed by 1 to 255 chars.  
No assumptions are made about encodings.

> Please confirm or deny my following statement: "A variable of type  
> String
> may contain an UTF-8 encoded string, i.e. a programmer using UTF-8 in
> strings should keep in mind the consequences (no 1:1 mapping between
> graphems and bytes, i.e. iterating over bytes is NOT equal  
> iterating over
> graphems encoded in the string bytes)."

Correct.


Jonas





More information about the fpc-pascal mailing list