#DOCUMENTATION by stefan
class: CharacterEncoderImplementations::ISO10646_to_UTF8
comment/format in:
#characterSize:
#encode:
#readNext:charactersFrom:
#readNextCharacterFrom:
class: CharacterEncoderImplementations::ISO10646_to_UTF8 class
changed: #bytesToReadFor:
--- a/CharacterEncoderImplementations__ISO10646_to_UTF8.st Wed Jan 10 22:55:27 2018 +0100
+++ b/CharacterEncoderImplementations__ISO10646_to_UTF8.st Wed Jan 10 23:00:16 2018 +0100
@@ -105,6 +105,7 @@
!ISO10646_to_UTF8 class methodsFor:'queries'!
bytesToReadFor:firstByte
+ (firstByte bitAnd:2r10000000) == 0 ifTrue:[^ 1].
(firstByte bitAnd:2r11000000) == 2r10000000 ifTrue:[^ 2].
(firstByte bitAnd:2r11100000) == 2r11000000 ifTrue:[^ 3].
(firstByte bitAnd:2r11110000) == 2r11100000 ifTrue:[^ 4].
@@ -114,7 +115,7 @@
InvalidEncodingError raiseWith:firstByte errorString:' - unsupported utf8 encoding (too large, only 31bit supported)'
"Created: / 14-06-2005 / 17:17:24 / janfrog"
- "Modified: / 04-01-2018 / 00:49:31 / stefan"
+ "Modified: / 10-01-2018 / 22:59:20 / stefan"
! !
!ISO10646_to_UTF8 methodsFor:'encoding & decoding'!
@@ -142,9 +143,9 @@
encode:aCode
"given a codePoint in unicode, return a byte in my encoding for it"
- self shouldNotImplement "/ no conversion to a single byte is possible
+ self shouldNotImplement "/ no vonversion to a single byte is possible
- "Modified (comment): / 03-01-2018 / 23:14:03 / stefan"
+ "Modified (comment): / 03-01-2018 / 23:13:58 / stefan"
!
encodeCharacter:aUnicodeCharacter on:aStream
@@ -173,13 +174,13 @@
!ISO10646_to_UTF8 methodsFor:'queries'!
-characterSize:charOrCodePoint
+characterSize:charOrcodePoint
"return the number of bytes required to encode codePoint"
- ^ charOrCodePoint asCharacter utf8BytesPerCharacter.
+ ^ charOrcodePoint asCharacter utf8BytesPerCharacter.
"Created: / 15-06-2005 / 15:16:22 / janfrog"
- "Modified (format): / 03-01-2018 / 23:10:01 / stefan"
+ "Modified: / 03-01-2018 / 23:05:59 / stefan"
!
nameOfEncoding
@@ -209,14 +210,14 @@
^ s contents asString
"Created: / 16-06-2005 / 11:45:14 / masca"
- "Modified: / 04-01-2018 / 01:20:15 / stefan"
+ "Modified: / 10-01-2018 / 22:28:39 / stefan"
!
readNextCharacterFrom:aStream
^ Character utf8DecodeFrom:aStream.
"Created: / 14-06-2005 / 17:03:59 / janfrog"
- "Modified: / 03-01-2018 / 22:58:41 / stefan"
+ "Modified: / 10-01-2018 / 17:35:40 / stefan"
! !
!ISO10646_to_UTF8 class methodsFor:'documentation'!