mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 04:33:23 +00:00
Output JSON strings as natural UTF-8 text without escapes (#4710)
* Added support for the non-escaped print of utf-8 string. * EscapeString: the first invalid symbol resets print_natural_utf8 flag to false. * Move the test to ParseAndGenerateTextTest. Fixes. * Removed dependence between `natural_utf8` and `allow_non_utf8` flags.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
85faa46fb3
commit
12c4c2238c
@@ -69,6 +69,8 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
|
||||
" --allow-non-utf8 Pass non-UTF-8 input through parser and emit nonstandard\n"
|
||||
" \\x escapes in JSON. (Default is to raise parse error on\n"
|
||||
" non-UTF-8 input.)\n"
|
||||
" --natural-utf8 Output strings with UTF-8 as human-readable strings.\n"
|
||||
" By default, UTF-8 characters are printed as \\uXXXX escapes.\n"
|
||||
" --defaults-json Output fields whose value is the default when\n"
|
||||
" writing JSON\n"
|
||||
" --unknown-json Allow fields in JSON that are not defined in the\n"
|
||||
@@ -182,6 +184,8 @@ int FlatCompiler::Compile(int argc, const char **argv) {
|
||||
opts.strict_json = true;
|
||||
} else if (arg == "--allow-non-utf8") {
|
||||
opts.allow_non_utf8 = true;
|
||||
} else if (arg == "--natural-utf8") {
|
||||
opts.natural_utf8 = true;
|
||||
} else if (arg == "--no-js-exports") {
|
||||
opts.skip_js_exports = true;
|
||||
} else if (arg == "--goog-js-export") {
|
||||
|
||||
Reference in New Issue
Block a user