diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnUTF8Encoder.class/instance/ensureAtBeginOfCodePointOnStream..st b/repository/Zinc-Character-Encoding-Core.package/ZnUTF8Encoder.class/instance/ensureAtBeginOfCodePointOnStream..st index 5a8ff945..3f5685fa 100644 --- a/repository/Zinc-Character-Encoding-Core.package/ZnUTF8Encoder.class/instance/ensureAtBeginOfCodePointOnStream..st +++ b/repository/Zinc-Character-Encoding-Core.package/ZnUTF8Encoder.class/instance/ensureAtBeginOfCodePointOnStream..st @@ -4,6 +4,8 @@ ensureAtBeginOfCodePointOnStream: stream if not move further backwards. This is necessary when a position in the binary stream is set, not knowing if that position is on a proper encoded character boundary." + "If we are at end-of-stream, we can't be in the middle of an encoded codepoint + (unless that codepoint is incomplete and thus invalid, which we won't worry about)" + stream atEnd ifTrue: [ ^ self ]. "Back up until we are not longer on a continuation byte but on a leading byte" - [ (stream peek bitAnd: 2r11000000) == 2r10000000 ] whileTrue: [ stream back ] \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st index 2cb3537b..f2721d0c 100644 --- a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Zinc-Character-Encoding-Core'! +self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Core' withTags: #()! diff --git a/repository/Zinc-Character-Encoding-Tests.package/ZnCharacterStreamTest.class/instance/testUTF8ReadStreamPositioning.st b/repository/Zinc-Character-Encoding-Tests.package/ZnCharacterStreamTest.class/instance/testUTF8ReadStreamPositioning.st index 9cc9d865..14378fea 100644 --- a/repository/Zinc-Character-Encoding-Tests.package/ZnCharacterStreamTest.class/instance/testUTF8ReadStreamPositioning.st +++ b/repository/Zinc-Character-Encoding-Tests.package/ZnCharacterStreamTest.class/instance/testUTF8ReadStreamPositioning.st @@ -17,4 +17,6 @@ testUTF8ReadStreamPositioning stream position: 5. self assert: stream next equals: $v. stream position: 6. - self assert: stream next equals: $e \ No newline at end of file + self assert: stream next equals: $e. + stream position: 7. + self assert: stream atEnd. \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st index d2931a20..099ac033 100644 --- a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Zinc-Character-Encoding-Tests'! +self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Tests' withTags: #()!