Skip to content

The problem of incorrect transcoding in Chinese #803

Closed
@zhbgs2000

Description

@zhbgs2000
	Json::Value json_temp; 
	json_temp["name"]	= "中国234";
	string name			= json_temp["name"].asString();
	Json::Value root;  		
	root["key_number"]	= Json::Value(12345);					
	root["key_boolean"] = Json::Value(false);					
	root["key_double"]	= Json::Value(12.345);					
	root["key_object"]	= json_temp;													
						
	Json::StreamWriterBuilder builder;
	builder["commentStyle"] = "None";
	builder["indentation"] = "";
	//string s		= fast_writer.write(root);
	//string_t s	= utility::conversions::to_string_t(fast_writer.write(root));
	//string result = fast_writer.write(root);
	string result = Json::writeString(builder, root);
	cout <<"name: "<< name << endl;	//is ok
	cout <<"result: "<< result << endl; //no ok
       ......

print info:
name: 中国234
result: {"key_boolean":false,"key_double":12.345000000000001,"key_number":12345,"key_object":{"name":"\u0590\u067a234"}}

jsoncpp version:1.8.4
ide: visual studio 2017 c++
The value of the variable name is displayed in Chinese, and the Chinese contained in variable result cannot be displayed properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions