[Seaside-dev] testCodecLatin1 and testCodecUtf8Bom
Paolo Bonzini
bonzini at gnu.org
Sun May 16 16:35:41 UTC 2010
On Sun, May 16, 2010 at 15:00, Philippe Marschall
<philippe.marschall at gmail.com> wrote:
> 2010/5/15 Michael Lucas-Smith <mlucas-smith at cincom.com>:
>> Hi All,
>>
>> #testCodecLatin1 and #testCodecUtf8Bom fail for me on VisualWorks.. once the
>> Unicode string is created, #asByteArray is sent to it to "turn it back to
>> bytes" but of course this is impossible, it's already a TwoByteString in
>> VisualWorks and to turn that back to bytes, you need to specify an encoding
>> using #asByteArrayEncoding: 'utf-8' (for example).
>
> You're right, looking at it again, using #asByteArray seems
> problematic due to it's underspecified nature.
>
>> Can these tests be written with a custom compare operation? the comment in
>> #testCodecLatin1 explains the problem - that comparing unicode strings using
>> #= is not necessarily going to work across platforms, but perhaps something
>> like this might work everywhere:
>>
>> compare: a with: b
>> a size = b size ifFalse: [^false].
>> 1 to: a size do: [:index | (a at: index) = (b at: index) ifFalse:
>> [^false]].
>> ^true
>
> If that works with everybody, sure.
It doesn't work for gst. I think it's simplest to add something like
#assert:equalsDecodedString: and let the platform package define it.
Paolo
More information about the seaside-dev
mailing list