Repository navigation
fix: keep UTF-8 continuations inside an OSC string - #54
Open
Sash (SashaMIT) wants to merge 1 commit into
Open
Sash (SashaMIT) wants to merge 1 commit into
Sash (SashaMIT) wants to merge 1 commit into
Conversation
A title containing U+0410 (D0 90) treated 0x90 as DCS. The next byte then aborted Parse with a nil state, so the rest of the stream was dropped. Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An OSC title that contains U+0410 is the bytes D0 90. 0x90 is also the DCS entry byte, so the parser left the string on the second byte of that character. The following byte then aborted
Parsewithnew state of 'nil' is invalid, and the rest of the stream was dropped.A continuation that belongs to a multibyte sequence started in the OSC string now stays in the string. A lone 0x90 still enters DCS. A lone 0x9C still ends the string. BEL still ends it.
U+2014 is E2 80 94. The 0x80 in the middle used to return to ground from inside the title. It stays in the string too.
TestOscStringUTF8Continuationcovers both titles, then a BEL and a followingX. On the old parser the U+0410 case returned the nil-state error. After the change the state is ground and the only call isPrint([X]).go test -count=1 ./...passed.Fixes #40.