[Pharo-project] TextConverter handling of binary streams
stephane.ducasse at inria.fr
Tue Nov 30 12:20:17 CET 2010
fix fix fix :)
> I would even go further, the test UTF8TextConverterTest>>#testPutSingleCharacter is plain wrong, it seems to have been written as an afterthought:
> | actual |
> actual := ByteArray streamContents: [ :stream |
> | converter |
> converter := UTF8TextConverter new.
> nextPut: $a
> toStream: stream.
> nextPut: (Unicode value: 16r20AC)
> toStream: stream ].
> self assert: actual = #[97 0 0 32 172]
> The correct result is #[97 226 130 172] !!
> If you would give these bytes to any other system, they would never be able to decode them as UTF-8.
More information about the Pharo-project