[fpc-devel] new string - question on usage

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Oct 11 08:25:50 CEST 2011


Martin schrieb:

> In my case that is in synedit. Even if I changed every string in 
> synedit, it would still be used from the IDE and many user apps, with 
> just "string". So then the text would be corrupted at that point.

Text corruption can occur only when the stored encoding does not match 
the real encoding of the contained text (bytes). When the FPC 
implementation is finished, such mismatches should be possible only with 
strings read from files or other sources (OS/lib API), with wrong 
encodings specified on the FPC side.

> The only way to do that, is if every single fpc/lazarus user changes at 
> the same time.

When every user can have a different encoding of generic strings, we'll 
have to face bug reports which depend on the user locale!

> And what happens if an app did read data from some external source 
> (serial port) and then wants to declare what encoding it is?

That's not different from the current situation. Network communication 
must agree about the encoding to use, and the user is responsible for 
the correct encoding when local files are read or written. When files 
are stored in UTF-8 (or UTF-16), a BOM will leave no room for wrong 
guessing.

DoDi




More information about the fpc-devel mailing list