summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2019-06-07 09:53:41 -0700
committerGitHub <noreply@github.com>2019-06-07 09:53:41 -0700
commitd1bb5f81541e670b8d088f158d08c99a6a973281 (patch)
tree25a9969924b29918970616cd80aa02dbf0101d8e /src
parent986f5cc8bb85ba4ecc0dd3ed82fa39565ce9c419 (diff)
downloadwabt-d1bb5f81541e670b8d088f158d08c99a6a973281.tar.gz
wabt-d1bb5f81541e670b8d088f158d08c99a6a973281.tar.bz2
wabt-d1bb5f81541e670b8d088f158d08c99a6a973281.zip
Rely on UTF-8 encoding in JSON strings (#1088)
Fixes issue #1086.
Diffstat (limited to 'src')
-rw-r--r--src/binary-writer-spec.cc2
-rw-r--r--src/stream.h2
2 files changed, 2 insertions, 2 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.