[squeak-dev] The Trunk: Multilingual-nice.50.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Oct 5 18:53:47 UTC 2009


Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.50.mcz

==================== Summary ====================

Name: Multilingual-nice.50
Author: nice
Time: 5 October 2009, 8:52:58 am
UUID: 713520f0-e41d-4c59-91e5-51b1860cbc0c
Ancestors: Multilingual-nice.49

Apply cleanup from http://bugs.squeak.org/view.php?id=6395
Character>>asUnicodeChar seems weird:
- either it returns an Integer ($A asUnicodeChar)
- or a Character (16r100000F asCharacter asUnicodeChar)

Method comment says this method should be replaced...
It has a unique sender CompoundTextConverter>>nextFromStream:

The fix from Yoshiki is:
1) fix the behaviour to allways answer a Character
2) move the method in CompoundTextConverter>>toUnicode:

=============== Diff against Multilingual-nice.49 ===============

Item was added:
+ ----- Method: CompoundTextConverter>>toUnicode: (in category 'private') -----
+ toUnicode: aChar
+ 
+ 	| table charset v |
+ 	aChar leadingChar = 0 ifTrue: [^ aChar].
+ 	charset := EncodedCharSet charsetAt: aChar leadingChar.
+ 	charset isCharset ifFalse: [^ aChar].
+ 	table := charset ucsTable.
+ 	table isNil ifTrue: [^ Character value: 16rFFFD].
+ 
+ 	v := table at: aChar charCode + 1.
+ 	v = -1 ifTrue: [^ Character value: 16rFFFD].
+ 
+ 	^ Character leadingChar: charset unicodeLeadingChar code: v.!

Item was changed:
  ----- Method: CompoundTextConverter>>nextFromStream: (in category 'conversion') -----
  nextFromStream: aStream 
  
  	| character character2 size leadingChar offset result |
  	aStream isBinary ifTrue: [^ aStream basicNext].
  
  	character := aStream basicNext.
  	character ifNil: [^ nil].
  	character == Character escape ifTrue: [
  		self parseShiftSeqFromStream: aStream.
  		character := aStream basicNext.
  		character ifNil: [^ nil]].
  	character asciiValue < 128 ifTrue: [
  		size := state g0Size.
  		leadingChar := state g0Leading.
  		offset := 16r21.
  	] ifFalse: [
  		size :=state g1Size.
  		leadingChar := state g1Leading.
  		offset := 16rA1.
  	].
  	size = 1 ifTrue: [
  		leadingChar = 0
  			ifTrue: [^ character]
  			ifFalse: [^ Character leadingChar: leadingChar code: character asciiValue]
  	].
  	size = 2 ifTrue: [
  		character2 := aStream basicNext.
  		character2 ifNil: [^ nil. "self errorMalformedInput"].
  		character := character asciiValue - offset.
  		character2 := character2 asciiValue - offset.
  		result := Character leadingChar: leadingChar code: character * 94 + character2.
+ 		^ self toUnicode: result
- 		^ result asUnicodeChar.
- 		"^ self toUnicode: result"
  	].
  	self error: 'unsupported encoding'.
  !




More information about the Squeak-dev mailing list