[Seaside] UTF8TextConverter, GRPharoUtf8Codec,
GRPharoUtf8CodecStream against GRNullCodec
renggli at gmail.com
Thu Oct 13 16:46:30 UTC 2011
> When I have an Adapter with GRNullCodec I assume, that all (?) traffic,
> content (?) goes through the GRNullCodec, but due to the fact, that
> GRNullCodec does nothing, the traffic/content is not changed.
> If I use an adapter with GRPharoUtf8Codec is then the content converted
> to/from UTF8 ????
This assumes that the outside world uses UTF8. That means incoming
textual data is converted from UTF8 to Unicode. Outgoing textual data
from Unicode to UTF8.
> What does this mean to strings (in my application) I render on my pages like
> in the following command:
> html text: stringInSomeCodePage
If you typed 'stringInSomeCodePage' inside the image, you need to use
GRPharoUtf8Codec otherwise it might show up as garbage.
If all your strings come from outside the image (or you only have
ASCII Strings inside the image) and you do not depend on the meaning
of strings inside the image (that is you treat them as a binary
sequence of bytes only), you can also use GRNullCodec.
> In my firsts demos I held all my strings in UTF8 and used the GRNullCodec
> (and everything is ok in the browser side).
In the ASCII range Unicode and UTF8 are the same, so it does not
matter what you use.
> Then I changed to GRPharoUtf8Codec and it seems to me, that I got now an
> additional UTF8 conversion. Then I switched my application strings back to
> Latin1 and it was ok again.
> How does this all work with Unicode characters with code points > 255 (and
> usage of GRPharoUtf8Codec) (in Squeak: WideString)?
> When is a GRPharoUtf8Codec really needed ??
You should not switch when you have actual String data, you will just
get a mess of differently encoded Strings. Instead of the Utf8Codec
you can also use the Latin1 codec, that means outgoing data will be
Latin1, incoming data will be converted from Latin1.
In practice I don't see a reason why you would want anything else but UTF8.
> Perhaps this is a stupid question .... but then I would like to know it :-))
Philippe is the expert here. Check out his ESUG presentation:
More information about the seaside