#TUNING by stefan
class: CharacterEncoderImplementations::ISO10646_to_UTF8
added:
#encodeCharacter:on:
#encodeString:on:
--- a/CharacterEncoderImplementations__ISO10646_to_UTF8.st Thu Feb 16 20:48:38 2017 +0100
+++ b/CharacterEncoderImplementations__ISO10646_to_UTF8.st Thu Feb 16 20:48:47 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2004 by eXept Software AG
All Rights Reserved
@@ -67,7 +69,7 @@
Decoding (utf8 to unicode):
|t|
- t := ISO10646_to_UTF8 encodeString:'Helloœ'.
+ t := ISO10646_to_UTF8 encodeString:'Helloœ'.
ISO10646_to_UTF8 decodeString:t.
"
! !
@@ -124,12 +126,28 @@
self shouldNotImplement "/ no single byte conversion possible
!
+encodeCharacter:aUnicodeCharacter on:aStream
+ "given a character in unicode, encode it onto aStream."
+
+ aStream nextPutUtf8:aUnicodeCharacter.
+
+ "Created: / 16-02-2017 / 16:20:57 / stefan"
+!
+
encodeString:aUnicodeString
"return the UTF-8 representation of a Unicode string.
The resulting string is only useful to be stored on some external file,
not for being used inside ST/X."
^ aUnicodeString utf8Encoded.
+!
+
+encodeString:aUnicodeString on:aStream
+ "given a string in unicode, encode it onto aStream."
+
+ aStream nextPutAllUtf8:aUnicodeString.
+
+ "Created: / 16-02-2017 / 16:27:31 / stefan"
! !
!ISO10646_to_UTF8 privateMethodsFor:'queries'!