[fpc-pascal] The new Delphi compatible unicode string
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Jan 4 15:56:42 CET 2011
On 04 Jan 2011, at 13:20, Juha Manninen wrote:
> The Java guy would ask if there is any common unicode string type. I
> would say
> "Not yet but it's coming, but we can't use it because we must
> support the old
> compiler versions".
Java's string type is roughly equivalent to FPC's UnicodeString: it
always uses UTF-16. If your source material uses a different encoding,
you have to load it into an array of bytes and then create a new
string based on the data in that array and the encoding that you
explicitly specify. Afterwards, the string remains UTF-16 and if you
want the original (or some other) encoding back, you again have to
explicitly convert it to an array of bytes with an explicitly
specified encoding. There are no automatic string encoding conversions
in Java.
Also, in general discussions based on "how can I prove that language X
is at least as good as, or better than, language Y" end in flame wars,
so please don't go there.
Jonas
More information about the fpc-pascal
mailing list