You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation wraps a Byte stream and the position of the ZnCharaterReadStream is returned using the byte position not character position, so the following test fails returning 4 and not 3 as expected for character position:
| string bytes stream res |
string := 'eißendeße'.
bytes := ZnUTF8Encoder new encodeString: string.
stream := (ZnCharacterReadStream on: bytes readStreamPortable).
res := stream next; next; next.
self assert: res equals: $ß.
self assert: stream position equals: 3.
This is from the test ZnCharacterStreamTests >> testUtf8EncodingStreamPosition.
The text was updated successfully, but these errors were encountered:
…reamTests and ZnLegacyCharacterStreamTests: testUpToAll, testUpToAllTwice and testUtf8EncodingStreamPositionFor...) are all apparently due to Issue #80
I took a look at Pharo's behavior around ZnCharacterReadSteam>>#position. Using a similar test case, Pharo's implementation also returns the byte position rather than the character position. Is this a semantic change we want to make? Or do we want to maintain semantics w/ Pharo?
| string bytes stream res |
string := 'eißßßßßßßßßßßßendeße'.
bytes := ZnUTF8Encoder new encodeString: string.
stream := (ZnCharacterReadStream on: bytes readStream).
res := stream next; next; next; next; next.
stream position. "-> 8 rather than 5"
The current implementation wraps a Byte stream and the position of the ZnCharaterReadStream is returned using the byte position not character position, so the following test fails returning 4 and not 3 as expected for character position:
This is from the test ZnCharacterStreamTests >> testUtf8EncodingStreamPosition.
The text was updated successfully, but these errors were encountered: