CharacterEncoder.st
branchjv
changeset 17807 06cc6c49e291
parent 17780 b6e42c92eba0
child 17814 b75a7f0c346b
--- a/CharacterEncoder.st	Tue Nov 09 13:54:57 2010 +0000
+++ b/CharacterEncoder.st	Tue Nov 09 16:24:28 2010 +0000
@@ -189,6 +189,27 @@
         CharacterEncoder::KOI8_U flushCode; generateSubclassCode.
 
         CharacterEncoder::JIS0208 flushCode; generateCode.
+
+    Please check if your encoder tables are complete; for example, with:
+        0 to:255 do:[:ebc |
+            |asc ebc2|
+
+            asc := CharacterEncoderImplementations::EBCDIC new decode:ebc.
+            asc notNil ifTrue:[
+               ebc2 := CharacterEncoderImplementations::EBCDIC new encode:asc.
+               self assert:(ebc2 = ebc)
+            ].
+        ].
+
+        0 to:255 do:[:asc |
+            |ebc asc2|
+
+            ebc := CharacterEncoderImplementations::EBCDIC new encode:asc.
+            ebc notNil ifTrue:[
+               asc2 := CharacterEncoderImplementations::EBCDIC new decode:ebc.
+               self assert:(asc2 = asc)
+            ].
+        ].
 "
 ! !
 
@@ -540,6 +561,8 @@
 
         (CP437              unicode     ( 'cp437'  'cp-437' 'ibm-437' 'ms-cp437' 'microsoft-cp437' 'ibm-cp437' ))
 
+        (EBCDIC             unicode     ( 'ebcdic' ))
+
         (GB2313_1980        unicode     ( 'gb2313' 'gb2313-1980' ))
 
         (HANGUL             unicode     ( 'hangul' ))
@@ -822,6 +845,13 @@
 
 encodeString:aString into:newEncoding
     ^ self encodeString:aString from:#'unicode' into:newEncoding
+
+    "
+     self encodeString:'hello' into:#ebcdic
+
+     self encodeString:(self encodeString:'hello' into:#ebcdic) from:#ebcdic into:#ascii    
+     self encodeString:(self encodeString:'hello' into:#ebcdic) from:#ebcdic into:#unicode    
+    "
 ! !
 
 !CharacterEncoder class methodsFor:'private'!
@@ -1592,18 +1622,19 @@
 !CharacterEncoder class methodsFor:'documentation'!
 
 version
-    ^ '$Id: CharacterEncoder.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+    ^ '$Id: CharacterEncoder.st 10590 2010-11-09 16:24:28Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.106 2009/12/11 16:54:00 cg Exp '
+    ^ 'Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.108 2010-09-20 16:00:45 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: CharacterEncoder.st 10544 2010-07-12 16:20:36Z vranyj1 $'
+    ^ '$Id: CharacterEncoder.st 10590 2010-11-09 16:24:28Z vranyj1 $'
 ! !
 
 CharacterEncoder initialize!
 
 
 
+