[YAML] Always double quote UTF-8 characters
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 19 Dec 2017 11:51:05 +0000 (11:51 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 19 Dec 2017 11:51:05 +0000 (11:51 +0000)
llvm-svn: 321068

llvm/include/llvm/Support/YAMLTraits.h

index 83b097a199d6bdf32c3ae93401b19e3e5b17a625..3ee556d7533537c5edadc37ca38a0608f5d42abe 100644 (file)
@@ -549,9 +549,9 @@ inline QuotingType needsQuotes(StringRef S) {
       // range.
       if (C <= 0x1F)
         return QuotingType::Double;
-      // C1 control block (0x80 - 0x9F) is excluded from the allowed character
-      // range.
-      if (C >= 0x80 && C <= 0x9F)
+
+      // Always double quote UTF-8.
+      if (C & 0x80 != 0)
         return QuotingType::Double;
 
       // The character is not safe, at least simple quoting needed.