CharacterEncoderImplementations__ISO10646_to_UTF16BE.st
changeset 24214 7853c5e56c17
parent 22472 45940fc5e0ad
child 25270 abd76d94ad4f
--- a/CharacterEncoderImplementations__ISO10646_to_UTF16BE.st	Tue May 28 14:46:30 2019 +0200
+++ b/CharacterEncoderImplementations__ISO10646_to_UTF16BE.st	Tue May 28 14:48:39 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2005 by eXept Software AG
               All Rights Reserved
@@ -61,7 +59,7 @@
   Decoding (utf16BE to unicode):
      |t|
 
-     t := ISO10646_to_UTF16BE encodeString:'ÄÖÜß'.
+     t := ISO10646_to_UTF16BE encodeString:'ÄÖÜß'.
      ISO10646_to_UTF16BE decodeString:t.
 
   Decoding (utf16LE-Bytes to unicode):
@@ -107,8 +105,7 @@
     out := CharacterWriteStream on:(String new:estimatedSize).
     [s atEnd] whileFalse:[
         codeIn := nextIn value.
-        codeIn <= 16rFF ifTrue:[
-        ] ifFalse:[
+        codeIn > 16rFF ifTrue:[
             (codeIn between:16rD800 and:16rDBFF) ifTrue:[
                 codeIn1 := codeIn.
                 codeIn2 := nextIn value.
@@ -191,6 +188,7 @@
     "
 
     "Modified: / 12-07-2012 / 19:56:12 / cg"
+    "Modified: / 28-05-2019 / 14:08:19 / Stefan Vogel"
 !
 
 encode:aCode
@@ -204,8 +202,8 @@
 
     |stream size "{ Class:SmallInteger }"|
 
-    stream := WriteStream on:(ByteArray uninitializedNew:aUnicodeString size * 2).
     size := aUnicodeString size.
+    stream := WriteStream on:(ByteArray uninitializedNew:size * 2).
 
     1 to:size do:[:idx |
         stream nextPutUtf16Bytes:(aUnicodeString at:idx) MSB:true.
@@ -237,6 +235,7 @@
     "
 
     "Modified: / 16-01-2018 / 19:38:30 / stefan"
+    "Modified: / 28-05-2019 / 13:49:53 / Stefan Vogel"
 ! !
 
 !ISO10646_to_UTF16BE methodsFor:'private'!