UnicodeString conversion truncation

Project:GNU Smalltalk
Component:Base classes
Category:bug
Priority:normal
Assigned:Unassigned
Status:fixed
Description

There seems to be another bug with UnicodeStrings.
Assume following program:

Eval [

 PackageLoader fileInPackage: #I18N.
 a := WriteStream on: (Array new).
 1 to: 100 do: [:nr| a nextPut: nr].
 str := (a contents collect: [:nr| nr printString]) join: ','.
 str displayNl.
 str2 := str asUnicodeString.
 "str2 asString displayNl."   "<- gives a backtrace"
 str3 := '', str2.
 str3 displayNl.

]

It prints two lines of numbers, here the second line
is truncated right after 88, like this: "...,88,8"

When I uncomment the commented line in the code snippet above I get a backtrace:

Object: Iconv new "<0x2ac0d49dba00>" error: incomplete input sequence
I18N.IncompleteSequenceError(Exception)>>signal
I18N.IncompleteSequenceError class(Exception class)>>signal
I18N.Encoders.Iconv>>convertMore
I18N.Encoders.Iconv>>atEnd
[] in I18N.Encoders.Iconv(Stream)>>do:
BlockClosure>>on:do:
I18N.Encoders.Iconv(Stream)>>do:
I18N.Encoders.Iconv(Stream)>>contents
UnicodeString>>asString
UndefinedObject>>executeStatements

Updates

#1 submitted by Paolo Bonzini on Sun, 10/21/2007 - 15:51
Status:active» fixed
Attachment:gst-iconv-more.patch (3.71 KB)

You opened a can of half a dozen different off-by-one and similar bugs. :-) All fixed in the attached patch

User login