diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 87d1777a..44a634dc 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -993,9 +993,9 @@ void ServiceConnection(AcceptedConnection *conn) std::vector file_data; if( load_file( fname.c_str(), file_data) == 0 ) { std::string str(file_data.data(), file_data.size()); - const char *contentType = "text/html"; + const char *contentType = "text/html; charset=utf-8"; if( strURI.find(".js") != std::string::npos ) - contentType = "text/javascript"; + contentType = "text/javascript; charset=utf-8"; if( strURI.find(".css") != std::string::npos ) contentType = "text/css"; if( strURI.find(".png") != std::string::npos ) diff --git a/src/json/json_spirit_writer_template.h b/src/json/json_spirit_writer_template.h index 28c49ddc..1568c2b7 100644 --- a/src/json/json_spirit_writer_template.h +++ b/src/json/json_spirit_writer_template.h @@ -75,6 +75,7 @@ namespace json_spirit if( add_esc_char( c, result ) ) continue; + /* const wint_t unsigned_c( ( c >= 0 ) ? c : 256 + c ); if( iswprint( unsigned_c ) ) @@ -85,6 +86,14 @@ namespace json_spirit { result += non_printable_to_string< String_type >( unsigned_c ); } + */ + // [MF] twister uses utf8 strings (and not any sort of wide char). + // only control characters need to be escaped, per JSON RFC spec. + if( c >=0 && c <= 0x1f ) { + result += non_printable_to_string< String_type >( c ); + } else { + result += c; + } } return result;