Hi Igor, Great catch ! How did you stumble upon this one ?
Anyway, it shows that unless you really test all boundaries explicitly, silly one-off errors like that manage to survive for quite some time. I added a unit test doing just that. Fixed upstream: === Name: Zinc-Character-Encoding-Core-SvenVanCaekenberghe.31 Author: SvenVanCaekenberghe Time: 2 April 2014, 2:14:36.890651 pm UUID: 3f6ae285-2973-4451-833b-16afbd0658d3 Ancestors: Zinc-Character-Encoding-Core-SvenVanCaekenberghe.30 Fixed a one-off error in ZnUTF8Encoder>>#nextPut:toStream (thanks Igor Stasenko) === Name: Zinc-Character-Encoding-Tests-SvenVanCaekenberghe.18 Author: SvenVanCaekenberghe Time: 2 April 2014, 2:15:51.938152 pm UUID: c7048056-52ae-484f-a466-7d537f66690a Ancestors: Zinc-Character-Encoding-Tests-SvenVanCaekenberghe.17 Fixed a one-off error in ZnUTF8Encoder>>#nextPut:toStream (thanks Igor Stasenko) Added ZnCharacterEncoderTests>>#testUTF8Boundaries === Thanks again, Sven On 02 Apr 2014, at 13:18, Igor Stasenko <[email protected]> wrote: > nextPut: character toStream: stream > ... > code < 65535 ifTrue: [ > ... > > should be > > code < 65536 ifTrue: [ > > because 3-byte encoding can fit 16 bits, which is range > 0...65535 > but not > 0...65534 > > -- > Best regards, > Igor Stasenko.
