eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CharacterEncoderImplementations::ISO10646_to_UTF16LE':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ISO10646_to_UTF16LE (in CharacterEncoderImplementations)


Inheritance:

   Object
   |
   +--CharacterEncoder
      |
      +--CharacterEncoderImplementations::VariableBytesEncoder
         |
         +--CharacterEncoderImplementations::ISO10646_to_UTF16BE
            |
            +--CharacterEncoderImplementations::ISO10646_to_UTF16LE

Package:
stx:libbasic
Category:
Collections-Text-Encodings
Version:
rev: 1.10 date: 2023/11/23 13:36:05
user: stefan
file: CharacterEncoderImplementations__ISO10646_to_UTF16LE.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


encodes/decodes UTF16 LittleEndian (little-end-first)

Notice the naming (many are confused):
    Unicode is the set of number-to-glyph assignments
whereas:
    UTF8, UTF16 etc. are a concrete way of xmitting Unicode codePoints (numbers).

ST/X NEVER uses UTF8 or UTF16 internally - all characters are full 24bit characters.
Only when exchanging data, are these converted into UTF8 (or other) byte sequences.

copyright

COPYRIGHT (c) 2005 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

queries
o  bomBytes


Instance protocol:

encoding & decoding
o  decode: codePoint

o  encode: codePoint

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

o  encodeString: aUnicodeString on: aStream
given a string in unicode, encode it onto aStream.

private
o  nextTwoByteValueFrom: aStream

queries
o  nameOfEncoding

stream support
o  encodeCharacter: aUnicodeCharacter on: aStream
given a character in unicode, encode it onto aStream.


Examples:


Encoding (unicode to utf16LE)
   ISO10646_to_UTF16LE encodeString:'hello'.


Decoding (utf16LE to unicode):
   |t|

   t := ISO10646_to_UTF16LE encodeString:'ÄÖÜäöüß'.
   ISO10646_to_UTF16LE decodeString:t.

Decoding (utf16LE-Bytes to unicode):
   |bytes|

   bytes := #[ 16r40 0 16r41 0 16r42 0 16r43 0 16r44 0 ].
   ISO10646_to_UTF16LE decodeString:bytes.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:48:45 GMT