#TUNING by stefan
authorStefan Vogel <sv@exept.de>
Thu, 16 Feb 2017 20:48:47 +0100
changeset 21477 3a69148be78e
parent 21476 680cb70d9eb9
child 21478 2e63fbcbfa85
#TUNING by stefan class: CharacterEncoderImplementations::ISO10646_to_UTF8 added: #encodeCharacter:on: #encodeString:on:
CharacterEncoderImplementations__ISO10646_to_UTF8.st
--- 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'!