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 options for escape_chars are not enough for my needs. Lately, I'm dumping strings like this:
domain\x{1b}username\x{1f}mailbox
Why? None of your business! (Well, actually, it's part of the db format in the Cyrus IMAP server.)
Anyway, the nonascii and nonlatin1 escape rules are very permissive. I would say that they're almost never what somebody wants. They always show the NUL byte as \0, but other control characters are passed through, meaning that they mostly become invisible without a hex dumper. Ugh! Also, both nonascii and nonlatin1 are annoying if I am dumping something with CJK, when I want to see 방탄소년단 dumped correctly, but I still want \x18 for CANCEL.
This introduces the nonprintable option for escape_chars, which will escape the 67 Unicode codepoints that are not Print, of which 65 are in the Latin-1 space. This will do much, much better at dealing with data with control characters. This is actually exactly "all the Control characters plus two extremely rare whitespace characters."
I think we can do better even than this, but this is so much more useful to me that I've started here.
I'm going to think about just what I want. But I think it's something like a mapping from character sets to how to escape them. When I dump things, I want \x20 to be shown as a literal space, but \x09 to be shown as a colorized ␉ probably. \x18 should be \x18 but I suspect that I want all "format" characters (ones matching /p{Format}/, like WORD JOINER or ZERO WIDTH SPACE or INVISIBLE TIMES) to be shown as \N{...}.
(Maybe the current patch should use /[\P{Print}\p{Format]]/ but then it needs a better name.)
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
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.
The current options for
escape_charsare not enough for my needs. Lately, I'm dumping strings like this:Why? None of your business! (Well, actually, it's part of the db format in the Cyrus IMAP server.)
Anyway, the
nonasciiandnonlatin1escape rules are very permissive. I would say that they're almost never what somebody wants. They always show the NUL byte as\0, but other control characters are passed through, meaning that they mostly become invisible without a hex dumper. Ugh! Also, bothnonasciiandnonlatin1are annoying if I am dumping something with CJK, when I want to see방탄소년단dumped correctly, but I still want\x18for CANCEL.This introduces the
nonprintableoption forescape_chars, which will escape the 67 Unicode codepoints that are notPrint, of which 65 are in the Latin-1 space. This will do much, much better at dealing with data with control characters. This is actually exactly "all the Control characters plus two extremely rare whitespace characters."