diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-24 01:00:08 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-24 01:00:08 +0000 | 
| commit | c7dac04c3480f3c20487f912f77343139fce2d99 (patch) | |
| tree | 21a09bce0171e27bd1e92649db9df797fa097cea /lib/Support/YAMLTraits.cpp | |
| parent | 044eb2f6afba375a914ac9d8024f8f5142bb912e (diff) | |
Notes
Diffstat (limited to 'lib/Support/YAMLTraits.cpp')
| -rw-r--r-- | lib/Support/YAMLTraits.cpp | 7 | 
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp index 05ca40f03018..f8a80ba87873 100644 --- a/lib/Support/YAMLTraits.cpp +++ b/lib/Support/YAMLTraits.cpp @@ -657,7 +657,12 @@ void Output::scalarString(StringRef &S, QuotingType MustQuote) {        }        i = j + 1;      } else if (MustQuote == QuotingType::Double && -               !sys::unicode::isPrintable(S[j])) { +               !sys::unicode::isPrintable(S[j]) && (S[j] & 0x80) == 0) { +      // If we're double quoting non-printable characters, we prefer printing +      // them as "\x" + their hex representation. Note that special casing is +      // needed for UTF-8, where a byte may be part of a UTF-8 sequence and +      // appear as non-printable, in which case we want to print the correct +      // unicode character and not its hex representation.        output(StringRef(&Base[i], j - i)); // "flush"        output(StringLiteral("\\x"));  | 
