mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-10-10 06:28:22 +00:00
govis: support double quote escapes
This is supported by both OpenBSD and FreBSD so it seems possible that we will run into \" sequences at some point. The handling is basically identical to \\ sequences. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
parent
7e2695a1be
commit
bd7b72e037
5 changed files with 27 additions and 19 deletions
|
@ -81,7 +81,8 @@ func vis(output *strings.Builder, ch byte, flag VisFlag) {
|
|||
// We must *always* encode stuff characters not in ASCII.
|
||||
case flag&VisGlob == VisGlob && isglob(ch):
|
||||
// Glob characters are graphical but can be forced to be encoded.
|
||||
case flag&VisNoSlash == 0 && ch == '\\':
|
||||
case flag&VisNoSlash == 0 && ch == '\\',
|
||||
flag&VisDoubleQuote == VisDoubleQuote && ch == '"':
|
||||
// Prefix \ if applicable.
|
||||
_ = output.WriteByte('\\')
|
||||
fallthrough
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue