Skip to content

Commit

Permalink
Fix escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltoli committed Dec 20, 2023
1 parent 9967b97 commit f7c8b2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/ast/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ std::string enquote(const std::string &str) {
if ((unsigned char)c >= 32 && (unsigned char)c < 127) {
result.push_back(c);
} else {
fmt::format_to(std::back_inserter(result), "\\x{:02x}", c);
fmt::format_to(
std::back_inserter(result), "\\x{:02x}",
static_cast<unsigned char>(c));
}
break;
}
Expand Down Expand Up @@ -1887,7 +1889,9 @@ static std::string escapeString(const std::string &str) {

for (char c : str) {
if (c == '"' || c == '\\' || !isprint(c)) {
fmt::format_to(std::back_inserter(result), "\\x{:02x}", c);
fmt::format_to(
std::back_inserter(result), "\\x{:02x}",
static_cast<unsigned char>(c));
} else {
result.push_back(c);
}
Expand Down

0 comments on commit f7c8b2f

Please sign in to comment.