[Seaside-dev] ByteArray>>seasideString

Philippe Marschall philippe.marschall at gmail.com
Wed Apr 22 20:16:30 UTC 2009


2009/4/22 Michael Lucas-Smith <mlucas-smith at cincom.com>:
> Philippe Marschall wrote:
>>
>> 2009/4/22 Michael Lucas-Smith <mlucas-smith at cincom.com>:
>>
>>>
>>> What encoding do you assume the bytes to be in when you call this?
>>>
>>
>> The implementation assumes latin-1. That doesn't mean that this makes
>> a lot of sense. To go from a ByteArray to a String you should use
>> WACodec so my proposal is to change the implementation to return
>> something like #printString. If that breaks something then it was
>> bugged anyway.
>>
>>
>
> Along those lines, the WAGenericCodec assumes you go from string to string,
> when it really should go from bytearray to string to bytearray - encoded
> it's just bytes, decoded it's a string.

Yepp, there is also serious complexity in the encoded streams to
handle strings and bytearrays at the same time. However a lot of
people including web servers give us strings when semantically they're
just bytearrays. Decades of Smalltalk heritage where a String was just
a ByteArray don't really help. Same for protocols that were ASCII
fist, then switched to Latin-1 and are now being painfully moved to
UTF-8. It feels like I have been trying to explaing the difference
between bytearray to strings for the last three years without success.
So yes I would like to do this but don't think it's practical.

> I'd be in favour of dumping attempts to turn strings directly in to bytes
> like this and also be in favor of making the codec transform between bytes
> and strings. How do other people feel about this?

See above.

Cheers
Philippe


More information about the seaside-dev mailing list