eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CharacterEncoderImplementations::ISO10646_to_UTF8':

Home

everywhere
www.exept.de
for:
[back]

Class: ISO10646_to_UTF8 (in CharacterEncoderImplementations)


Inheritance:

   Object
   |
   +--CharacterEncoder
      |
      +--CharacterEncoderImplementations::TwoByteEncoder
         |
         +--CharacterEncoderImplementations::ISO10646_to_UTF8

Package:
stx:libbasic
Category:
Collections-Text-Encodings
Version:
rev: 1.16 date: 2009/09/22 09:08:09
user: fm
file: Encoder_ISO10646_to_UTF8.st directory: libbasic
module: stx stc-classLibrary: libbasic

Instance protocol:

encoding & decoding
o  decode: aCode

o  decodeString: aStringOrByteCollection
given a string in UTF8 encoding,
return a new string containing the same characters, in 16bit (or more) encoding.
Returns either a normal String, a TwoByteString or a FourByteString instance.
Only useful, when reading from external sources.
This only handles up-to 30bit characters.

If you work a lot with utf8 encoded textFiles,
this is a first-class candidate for a primitive.

o  encode: aCode

o  encodeString: aUnicodeString
return the UTF-8 representation of a aUnicodeString.
The resulting string is only useful to be stored on some external file,
not for being used inside ST/X.

If you work a lot with utf8 encoded textFiles,
this is a first-class candidate for a primitive.

queries
o  private bytesToReadFor: firstByte

o  characterSize: charOrcodePoint
return the number of bytes required to encode codePoint

o  nameOfEncoding

stream support
o  readNext: charactersToRead charactersFrom: stream

o  readNextCharacterFrom: aStream


Examples:


Encoding (unicode to utf8) ISO10646_to_UTF8 encodeString:'hello'. Decoding (utf8 to unicode): |t| t := ISO10646_to_UTF8 encodeString:'Helloś'. ISO10646_to_UTF8 decodeString:t.

ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 08:10:56 GMT