--- a/CharArray.st Tue Jul 01 19:21:21 1997 +0200
+++ b/CharArray.st Wed Jul 02 15:04:08 1997 +0200
@@ -1142,7 +1142,7 @@
char2 := aString at:srcIdx.
srcIdx := srcIdx + 1.
b2 := char2 asciiValue.
- (b2 >= 64 and:[b2 <= 252]) ifTrue:[ "/ SJIS2
+ (b2 >= 64 and:[b2 <= 252]) ifTrue:[ "/ SJIS2
|adjust rowOffs cellOffs|
adjust := (b2 < 159) ifTrue:[1] ifFalse:[0].
@@ -1172,10 +1172,11 @@
dstIdx := dstIdx + 1.
newString at:dstIdx put:char2.
]
- ] ifFalse:[
- (b1 >= 161 and:[b1 <= 223]) ifTrue:[ "/ HALFWIDTH KATAKANA
+ ] ifFalse:[
+ (b1 >= 16rA1 "161" and:[b1 <= 16rDF "223"]) ifTrue:[ "/ HALFWIDTH KATAKANA
+ "/ map half-width katakan to 8E:xx
val := b1 - 128.
- val := val + (142 bitShift:8).
+ val := val + (16r8E bitShift:8).
newString at:dstIdx put:(Character value:val).
] ifFalse:[
"/ roman characters left untranslated
@@ -1198,7 +1199,7 @@
"
"Created: 28.6.1997 / 19:19:23 / cg"
- "Modified: 30.6.1997 / 15:51:41 / cg"
+ "Modified: 2.7.1997 / 12:08:20 / cg"
!
encodeIntoBIG5:aBIG5String
@@ -1464,13 +1465,13 @@
isSJIS := true.
"/ check for HALFWIDTH KATAKANA
- "/ 142:xx
+ "/ 8E:xx
(val bitAnd:16rFF00) == 16r8E00 ifTrue:[
|b|
b := (val bitAnd:16rFF) + 128.
- (b >= 161 and:[b <= 223]) ifTrue:[
+ (b >= 16rA1 "161" and:[b <= 16rDF "223"]) ifTrue:[
out nextPut:(Character value:b).
isSJIS := false.
].
@@ -1515,7 +1516,7 @@
"
"Created: 28.6.1997 / 21:13:27 / cg"
- "Modified: 30.6.1997 / 18:16:37 / cg"
+ "Modified: 2.7.1997 / 12:07:56 / cg"
!
encodeRomans:aTwoByteString
@@ -3107,18 +3108,32 @@
encodingSymbol isNil ifTrue:[^ self].
+ "/ notice: this method may not be moved to
+ "/ concrete TwoByte classes; it is also invoked
+ "/ to convert singleByte strings ...
+
(encodingSymbol startsWith:'jis') ifTrue:[
- ^ JISEncodedString encodeRomans:self
+ newString := JISEncodedString encodeRomans:self.
+
+ "/ jisx0208.1983 has no half-width katakana
+ (encodingSymbol startsWith:'jisx0208.1983') ifTrue:[
+ newString := JISEncodedString encodeHalfWidthKatakana:newString.
+ ].
+ ^ newString
].
+
(encodingSymbol startsWith:'big5') ifTrue:[
^ BIG5EncodedString encodeRomans:self
].
+
(encodingSymbol startsWith:'gb') ifTrue:[
^ GBEncodedString encodeRomans:self
].
- (encodingSymbol startsWith:'ksc') ifTrue:[
+
+ (encodingSymbol startsWith:'ksc') ifTrue:[
^ KSCEncodedString encodeRomans:self
].
+
(encodingSymbol startsWith:'uni') ifTrue:[
^ UnicodeString encodeRomans:self
].
@@ -3131,7 +3146,7 @@
newString = self ifTrue:[^ self].
^ newString
- "Modified: 1.7.1997 / 17:16:55 / cg"
+ "Modified: 2.7.1997 / 15:02:56 / cg"
!
encodeInto:encodingSymbol
@@ -4823,6 +4838,6 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/CharArray.st,v 1.123 1997-07-01 15:28:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/CharArray.st,v 1.124 1997-07-02 13:04:08 cg Exp $'
! !
CharacterArray initialize!
--- a/CharacterArray.st Tue Jul 01 19:21:21 1997 +0200
+++ b/CharacterArray.st Wed Jul 02 15:04:08 1997 +0200
@@ -1142,7 +1142,7 @@
char2 := aString at:srcIdx.
srcIdx := srcIdx + 1.
b2 := char2 asciiValue.
- (b2 >= 64 and:[b2 <= 252]) ifTrue:[ "/ SJIS2
+ (b2 >= 64 and:[b2 <= 252]) ifTrue:[ "/ SJIS2
|adjust rowOffs cellOffs|
adjust := (b2 < 159) ifTrue:[1] ifFalse:[0].
@@ -1172,10 +1172,11 @@
dstIdx := dstIdx + 1.
newString at:dstIdx put:char2.
]
- ] ifFalse:[
- (b1 >= 161 and:[b1 <= 223]) ifTrue:[ "/ HALFWIDTH KATAKANA
+ ] ifFalse:[
+ (b1 >= 16rA1 "161" and:[b1 <= 16rDF "223"]) ifTrue:[ "/ HALFWIDTH KATAKANA
+ "/ map half-width katakan to 8E:xx
val := b1 - 128.
- val := val + (142 bitShift:8).
+ val := val + (16r8E bitShift:8).
newString at:dstIdx put:(Character value:val).
] ifFalse:[
"/ roman characters left untranslated
@@ -1198,7 +1199,7 @@
"
"Created: 28.6.1997 / 19:19:23 / cg"
- "Modified: 30.6.1997 / 15:51:41 / cg"
+ "Modified: 2.7.1997 / 12:08:20 / cg"
!
encodeIntoBIG5:aBIG5String
@@ -1464,13 +1465,13 @@
isSJIS := true.
"/ check for HALFWIDTH KATAKANA
- "/ 142:xx
+ "/ 8E:xx
(val bitAnd:16rFF00) == 16r8E00 ifTrue:[
|b|
b := (val bitAnd:16rFF) + 128.
- (b >= 161 and:[b <= 223]) ifTrue:[
+ (b >= 16rA1 "161" and:[b <= 16rDF "223"]) ifTrue:[
out nextPut:(Character value:b).
isSJIS := false.
].
@@ -1515,7 +1516,7 @@
"
"Created: 28.6.1997 / 21:13:27 / cg"
- "Modified: 30.6.1997 / 18:16:37 / cg"
+ "Modified: 2.7.1997 / 12:07:56 / cg"
!
encodeRomans:aTwoByteString
@@ -3107,18 +3108,32 @@
encodingSymbol isNil ifTrue:[^ self].
+ "/ notice: this method may not be moved to
+ "/ concrete TwoByte classes; it is also invoked
+ "/ to convert singleByte strings ...
+
(encodingSymbol startsWith:'jis') ifTrue:[
- ^ JISEncodedString encodeRomans:self
+ newString := JISEncodedString encodeRomans:self.
+
+ "/ jisx0208.1983 has no half-width katakana
+ (encodingSymbol startsWith:'jisx0208.1983') ifTrue:[
+ newString := JISEncodedString encodeHalfWidthKatakana:newString.
+ ].
+ ^ newString
].
+
(encodingSymbol startsWith:'big5') ifTrue:[
^ BIG5EncodedString encodeRomans:self
].
+
(encodingSymbol startsWith:'gb') ifTrue:[
^ GBEncodedString encodeRomans:self
].
- (encodingSymbol startsWith:'ksc') ifTrue:[
+
+ (encodingSymbol startsWith:'ksc') ifTrue:[
^ KSCEncodedString encodeRomans:self
].
+
(encodingSymbol startsWith:'uni') ifTrue:[
^ UnicodeString encodeRomans:self
].
@@ -3131,7 +3146,7 @@
newString = self ifTrue:[^ self].
^ newString
- "Modified: 1.7.1997 / 17:16:55 / cg"
+ "Modified: 2.7.1997 / 15:02:56 / cg"
!
encodeInto:encodingSymbol
@@ -4823,6 +4838,6 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.123 1997-07-01 15:28:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.124 1997-07-02 13:04:08 cg Exp $'
! !
CharacterArray initialize!