Preprocess and convert C1 controls to their 7 bit equivalent #10200

Closed
opened 2026-01-31 02:15:07 +00:00 by claunia · 6 comments
Owner

Originally created by @skyline75489 on GitHub (Aug 17, 2020).

Description of the new feature/enhancement

This is from a discussion in #6328:

@j4james: I was actually wondering whether this was something we could handle as a sort of preprocessing step that converts all of the C1 controls into their two character 7-bit equivalent. That way we can drop all the extra code that's checking for 90 and 9B introducers, and 9C terminators, because those conditions would now be handled as regular 7-bit escapes.

Originally created by @skyline75489 on GitHub (Aug 17, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement This is from a discussion in #6328: > @j4james: I was actually wondering whether this was something we could handle as a sort of preprocessing step that converts all of the C1 controls into their two character 7-bit equivalent. That way we can drop all the extra code that's checking for 90 and 9B introducers, and 9C terminators, because those conditions would now be handled as regular 7-bit escapes. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). -->
Author
Owner

@jdebp commented on GitHub (Aug 18, 2020):

Surely the other way around is better? Technically, per ECMA-48, it's those actual C1 characters that delimit command strings and control strings, and that begin control sequences. ESC Fe sequences are just ways to represent them for 7-bit transports. It has been almost 4 decades since the world went largely 8-bit clean.

@jdebp commented on GitHub (Aug 18, 2020): Surely the other way around is better? Technically, per ECMA-48, it's those actual C1 characters that delimit command strings and control strings, and that begin control sequences. `ESC Fe` sequences are just ways to represent them for 7-bit transports. It has been almost 4 decades since the world went largely 8-bit clean.
Author
Owner

@j4james commented on GitHub (Aug 18, 2020):

Surely the other way around is better?

Semantically does it make any difference? The only reason I was suggesting converting from the C1 controls to the 7-bit escapes was because I thought that would be easier to handle the way our parser is setup.

It has been almost 4 decades since the world went largely 8-bit clean.

That may be so, but in practice most people are using UTF-8 nowdays, so those C1 controls don't really gain you anything and are very rarely supported (at least in my experience).

@j4james commented on GitHub (Aug 18, 2020): > Surely the other way around is better? Semantically does it make any difference? The only reason I was suggesting converting from the C1 controls to the 7-bit escapes was because I thought that would be easier to handle the way our parser is setup. > It has been almost 4 decades since the world went largely 8-bit clean. That may be so, but in practice most people are using UTF-8 nowdays, so those C1 controls don't really gain you anything and are very rarely supported (at least in my experience).
Author
Owner

@skyline75489 commented on GitHub (Aug 20, 2020):

If I'm not mistaken, converting ESC Fe to C1 characters would require looking ahead one character beyond ESC. That would also be troublesome. I'd prefer the other way around which is techinically the same.

@skyline75489 commented on GitHub (Aug 20, 2020): If I'm not mistaken, converting `ESC Fe` to C1 characters would require looking ahead one character beyond `ESC`. That would also be troublesome. I'd prefer the other way around which is techinically the same.
Author
Owner

@jdebp commented on GitHub (Aug 29, 2020):

You're looking to the next character anyway, otherwise you simply aren't doing escape sequences right. And of course converting to the C1 characters means that scanning for (say) ST at the end of a command string or control string is just a single character test.

@jdebp commented on GitHub (Aug 29, 2020): You're looking to the next character _anyway_, otherwise you simply aren't doing escape sequences right. And of course converting to the C1 characters means that scanning for (say) ST at the end of a command string or control string is just a single character test.
Author
Owner

@skyline75489 commented on GitHub (Aug 30, 2020):

Well that’s not wrong but we are somewhat stuck with the current implementation that’s prioritizing 7bit instead of 8bit. And you can check out my PR #7340 if you’re interested.

@skyline75489 commented on GitHub (Aug 30, 2020): Well that’s not wrong but we are somewhat stuck with the current implementation that’s prioritizing 7bit instead of 8bit. And you can check out my PR #7340 if you’re interested.
Author
Owner

@ghost commented on GitHub (Sep 22, 2020):

:tada:This issue was addressed in #7340, which has now been successfully released as Windows Terminal Preview v1.4.2652.0.🎉

Handy links:

@ghost commented on GitHub (Sep 22, 2020): :tada:This issue was addressed in #7340, which has now been successfully released as `Windows Terminal Preview v1.4.2652.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.4.2652.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10200