diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/s2wasm.h | 1 | ||||
-rw-r--r-- | src/wasm.h | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h index 6f209a436..85d9f6c9e 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -190,6 +190,7 @@ private: case 'f': str.push_back('\f'); s += 2; continue; case 'b': str.push_back('\b'); s += 2; continue; case '\\': str.push_back('\\'); s += 2; continue; + case '"': str.push_back('"'); s += 2; continue; default: { if (isdigit(s[1])) { int code = (s[1] - '0')*8*8 + (s[2] - '0')*8 + (s[3] - '0'); diff --git a/src/wasm.h b/src/wasm.h index d53c4e629..3f3b7c271 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -1045,8 +1045,13 @@ public: case '\f': o << "\\f"; break; case '\b': o << "\\b"; break; case '\\': o << "\\\\"; break; - case 0: o << "\\0"; break; - default: o << c; // TODO: escaping + default: { + if (c >= 32 && c < 127) { + o << c; + } else { + o << std::hex << '\\' << (c/16) << (c%16) << std::dec; + } + } } } o << "\")"; |