From 07b91a81c169091b2464e6d587666ad3f0124a1e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 20 Feb 2024 13:23:10 -0800 Subject: StringLowering: Escape the JSON in the custom section (#6316) Also add an end-to-end test using node to verify we can parse the escaped content properly using TextDecoder+JSON.parse. --- src/support/string.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/support/string.h') diff --git a/src/support/string.h b/src/support/string.h index 8ab0ae1a6..6fb3f693b 100644 --- a/src/support/string.h +++ b/src/support/string.h @@ -75,7 +75,9 @@ inline bool isNumber(const std::string& str) { return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit); } -std::ostream& printEscaped(std::ostream& os, std::string_view str); +std::ostream& printEscaped(std::ostream& os, const std::string_view str); + +std::ostream& printEscapedJSON(std::ostream& os, const std::string_view str); } // namespace wasm::String -- cgit v1.2.3