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.

Reply via email to