Xcode: Invert quoting logic to whitelist of characters
Our explicit list of characters that require quoting does not account for non-ascii characters (e.g. UTF-8) that also need quoting. Invert the logic to quote a string unless it contains exclusively a set of characters we whitelist.
This commit is contained in:
parent
f7a9ed7e90
commit
2eee2943cc
@ -243,7 +243,11 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
|
|||||||
bool needQuote =
|
bool needQuote =
|
||||||
(String.empty() ||
|
(String.empty() ||
|
||||||
String.find("//") != String.npos ||
|
String.find("//") != String.npos ||
|
||||||
String.find_first_of(" <>+-*=@[](){},~") != String.npos);
|
String.find_first_not_of(
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"0123456789"
|
||||||
|
"$_./") != String.npos);
|
||||||
const char* quote = needQuote? "\"" : "";
|
const char* quote = needQuote? "\"" : "";
|
||||||
|
|
||||||
// Print the string, quoted and escaped as necessary.
|
// Print the string, quoted and escaped as necessary.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user