Opened at 2010-07-22T01:36:05Z
Last modified at 2011-01-22T04:50:49Z
#1135 closed defect
reduce unnecessary escaping in quote_output — at Version 3
Reported by: | davidsarah | Owned by: | davidsarah |
---|---|---|---|
Priority: | major | Milestone: | 1.8β |
Component: | code-frontend-cli | Version: | 1.7.1 |
Keywords: | usability unicode reviewed | Cc: | |
Launchpad Bug: |
Description (last modified by davidsarah)
The quote_output function, which is used to output possibly-Unicode strings to stdout and stderr, does more backslash-escaping than is necessary for the output to be interpreted unambiguously. In particular, it will double any backslashes in the string, which makes Windows paths look ugly.
We can reduce this by making it follow POSIX-like escaping rules: within single quotes, backslashes are not special, and the only printable character that cannot appear is a single quote. If we do have a single quote or control characters in the string, then we use double quotes with backslash-escaping.
Change History (4)
comment:1 Changed at 2010-07-22T01:51:32Z by davidsarah
comment:2 Changed at 2010-07-22T02:00:21Z by davidsarah
- Owner set to davidsarah
- Status changed from new to assigned
comment:3 Changed at 2010-07-22T02:01:18Z by davidsarah
- Description modified (diff)
Changed at 2010-07-23T08:17:42Z by davidsarah
util.encodingutil: change quote_output to do less unnecessary escaping, and to use double-quotes more consistently when needed. This version avoids u-escaping for characters that are representable in the output encoding, when double quotes are used; and includes tests. fixes #1135
Please hold off reviewing this; the _double_quote function is broken for some inputs.