CharacterEncoder.st
changeset 14207 f80306416305
parent 14206 70aa64d89dca
child 14209 912e4845d386
equal deleted inserted replaced
14206:70aa64d89dca 14207:f80306416305
   255      (self encoderFor:#'utf32be') encodeString:'hello'      
   255      (self encoderFor:#'utf32be') encodeString:'hello'      
   256      self encoderFor:#'sgml'      
   256      self encoderFor:#'sgml'      
   257      self encoderFor:#'java'      
   257      self encoderFor:#'java'      
   258     "
   258     "
   259 
   259 
   260     "Modified: / 01-04-2011 / 14:27:22 / cg"
   260     "Modified: / 12-07-2012 / 19:35:43 / cg"
   261 !
   261 !
   262 
   262 
   263 encoderFor:encodingNameSymbolArg ifAbsent:exceptionValue
   263 encoderFor:encodingNameSymbolArg ifAbsent:exceptionValue
   264     "given the name of an encoding, return an encoder-instance which can map these from/into unicode."
   264     "given the name of an encoding, return an encoder-instance which can map these from/into unicode."
   265 
   265 
   393                         cls2 := clsName2
   393                         cls2 := clsName2
   394                     ] ifFalse:[
   394                     ] ifFalse:[
   395                         cls2 := CharacterEncoderImplementations at:clsName2.
   395                         cls2 := CharacterEncoderImplementations at:clsName2.
   396                     ].
   396                     ].
   397                     (cls1 notNil and:[cls2 notNil]) ifTrue:[
   397                     (cls1 notNil and:[cls2 notNil]) ifTrue:[
       
   398                         enc1 := cls1 new.
       
   399                         enc2 := cls2 new.
   398                         enc := TwoStepEncoder new encoder1:enc1 encoder2:enc2.
   400                         enc := TwoStepEncoder new encoder1:enc1 encoder2:enc2.
   399                         ^ enc.
   401                         ^ enc.
   400                     ].
   402                     ].
   401                 ]
   403                 ]
   402             ]
   404             ]
   414      self encoderFor:#'koi8-u'      
   416      self encoderFor:#'koi8-u'      
   415      self encoderFor:#'jis0208'      
   417      self encoderFor:#'jis0208'      
   416      self encoderFor:#'jis7'      
   418      self encoderFor:#'jis7'      
   417      self encoderFor:#'unicode'      
   419      self encoderFor:#'unicode'      
   418     "
   420     "
       
   421 
       
   422     "Modified: / 12-07-2012 / 19:45:58 / cg"
   419 !
   423 !
   420 
   424 
   421 encoderForUTF8
   425 encoderForUTF8
   422     "return an encoder-instance which can map unicode into/from utf8"
   426     "return an encoder-instance which can map unicode into/from utf8"
   423 
   427 
   508      CharacterEncoder encoderToEncodeFrom:#'koi8-r' into:#'mac-cyrillic'              
   512      CharacterEncoder encoderToEncodeFrom:#'koi8-r' into:#'mac-cyrillic'              
   509      CharacterEncoder encoderToEncodeFrom:#'ms-arabic' into:#'mac-arabic'           
   513      CharacterEncoder encoderToEncodeFrom:#'ms-arabic' into:#'mac-arabic'           
   510      CharacterEncoder encoderToEncodeFrom:#'iso8859-5' into:#'koi8-r'           
   514      CharacterEncoder encoderToEncodeFrom:#'iso8859-5' into:#'koi8-r'           
   511      CharacterEncoder encoderToEncodeFrom:#'koi8-r' into:#'koi8-u'       
   515      CharacterEncoder encoderToEncodeFrom:#'koi8-r' into:#'koi8-u'       
   512     "
   516     "
       
   517 
       
   518     "Modified: / 12-07-2012 / 19:45:15 / cg"
   513 ! !
   519 ! !
   514 
   520 
   515 !CharacterEncoder class methodsFor:'Compatibility-ST80'!
   521 !CharacterEncoder class methodsFor:'Compatibility-ST80'!
   516 
   522 
   517 encoderNamed: encoderName
   523 encoderNamed: encoderName
  1655 ! !
  1661 ! !
  1656 
  1662 
  1657 !CharacterEncoder class methodsFor:'documentation'!
  1663 !CharacterEncoder class methodsFor:'documentation'!
  1658 
  1664 
  1659 version
  1665 version
  1660     ^ '$Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.116 2012-07-12 13:43:15 stefan Exp $'
  1666     ^ '$Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.117 2012-07-12 17:46:42 cg Exp $'
  1661 !
  1667 !
  1662 
  1668 
  1663 version_CVS
  1669 version_CVS
  1664     ^ '$Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.116 2012-07-12 13:43:15 stefan Exp $'
  1670     ^ '$Header: /cvs/stx/stx/libbasic/CharacterEncoder.st,v 1.117 2012-07-12 17:46:42 cg Exp $'
  1665 ! !
  1671 ! !
  1666 
  1672 
  1667 CharacterEncoder initialize!
  1673 CharacterEncoder initialize!