diff options
-rw-r--r-- | src/binary-writer-spec.cc | 2 | ||||
-rw-r--r-- | src/stream.h | 2 | ||||
-rwxr-xr-x | test/run-spec-wasm2c.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index ded6fa2f..002162ce 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -110,7 +110,7 @@ void BinaryWriterSpec::WriteEscapedString(string_view s) { json_stream_->WriteChar('"'); for (size_t i = 0; i < s.length(); ++i) { uint8_t c = s[i]; - if (c < 0x20 || c == '\\' || c == '"' || c > 0x7f) { + if (c < 0x20 || c == '\\' || c == '"') { json_stream_->Writef("\\u%04x", c); } else { json_stream_->WriteChar(c); diff --git a/src/stream.h b/src/stream.h index 87cae087..aab7be57 100644 --- a/src/stream.h +++ b/src/stream.h @@ -106,7 +106,7 @@ class Stream { void WriteChar(char c, const char* desc = nullptr, PrintChars print_chars = PrintChars::No) { - WriteU8(c, desc, print_chars); + WriteU8(static_cast<unsigned char>(c), desc, print_chars); } // Dump memory as text, similar to the xxd format. diff --git a/test/run-spec-wasm2c.py b/test/run-spec-wasm2c.py index 741722f9..c941d57e 100755 --- a/test/run-spec-wasm2c.py +++ b/test/run-spec-wasm2c.py @@ -95,7 +95,7 @@ def MangleTypes(types): def MangleName(s): result = 'Z_' - for c in s: + for c in s.encode('utf-8'): # NOTE(binji): Z is not allowed. if c in '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY0123456789': result += c |