[fpc-devel] Unicode resource strings
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Tue Aug 21 13:35:36 CEST 2012
Aleksa Todorovic schrieb:
> The problem here is that libraries floating around (including RTL and
> FCL) use different string types (UnicodeString, UTF8String,
> AnsiString), so the question is - is it possible to (re)write those
> libraries in a generic way (RawByteString?), so they can work with any
> string type?
RawByteStrings are not a solution, because the specific encoding of
every parameter has to be checked inside such a subroutine, and specific
handling of all encodings has to be implemented there. It's easier to
expect strings of a specific encoding, and let the compiler insert
eventual conversions automatically. Then overloaded subroutines can be
provided, for the 3 common encodings (CP_ACP, CP_UTF8 and UTF-16).
What I'm missing is a true binary string encoding, which never is
subject to automatic conversions. Why implement TBytes or similar
classes for data buffers, with zero comfort compared to standard
stringhangling operators/functions?
DoDi
More information about the fpc-devel
mailing list