Encoder_ISO10646_to_SGML.st
changeset 10108 8e610353f2fa
parent 8171 ac837a7ca3a3
equal deleted inserted replaced
10107:1f6b0d1dc78e 10108:8e610353f2fa
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
       
    13 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
    14 
    13 
    15 "{ NameSpace: CharacterEncoderImplementations }"
    14 "{ NameSpace: CharacterEncoderImplementations }"
    16 
    15 
    17 TwoByteEncoder subclass:#ISO10646_to_SGML
    16 TwoByteEncoder subclass:#ISO10646_to_SGML
   121 encode:aCode
   120 encode:aCode
   122     self shouldNotImplement "/ no single byte conversion possible
   121     self shouldNotImplement "/ no single byte conversion possible
   123 !
   122 !
   124 
   123 
   125 encodeString:aUnicodeString
   124 encodeString:aUnicodeString
   126     "return the UTF-8 representation of a aUnicodeString.
   125     "return the SGML representation of aUnicodeString.
   127      The resulting string is only useful to be stored on some external file,
   126      The resulting string is only useful to be stored on some external file,
   128      not for being used inside ST/X.
   127      not for being used inside ST/X."
   129 
       
   130      If you work a lot with utf8 encoded textFiles, 
       
   131      this is a first-class candidate for a primitive."
       
   132 
   128 
   133     |ch in out codePoint|
   129     |ch in out codePoint|
   134 
   130 
   135     in := aUnicodeString readStream.
   131     in := aUnicodeString readStream.
   136     out := WriteStream on:(String new:10).
   132     out := WriteStream on:(String new:10).
   149 
   145 
   150     "
   146     "
   151      CharacterEncoderImplementations::ISO10646_to_SGML
   147      CharacterEncoderImplementations::ISO10646_to_SGML
   152         encodeString:'hello äöü' 
   148         encodeString:'hello äöü' 
   153     "
   149     "
       
   150 
       
   151     "Modified: / 23-10-2006 / 13:25:27 / cg"
   154 ! !
   152 ! !
   155 
   153 
   156 !ISO10646_to_SGML class methodsFor:'documentation'!
   154 !ISO10646_to_SGML class methodsFor:'documentation'!
   157 
   155 
   158 version
   156 version
   159     ^ '$Header: /cvs/stx/stx/libbasic/Attic/Encoder_ISO10646_to_SGML.st,v 1.2 2004-03-12 12:52:36 cg Exp $'
   157     ^ '$Header: /cvs/stx/stx/libbasic/Attic/Encoder_ISO10646_to_SGML.st,v 1.3 2006-10-23 11:25:11 cg Exp $'
   160 ! !
   158 ! !