comparison Core/RestApi/RestApiOutput.cpp @ 2118:9cf176bc21ad

Content-Type for JSON documents is now "application/json; charset=utf-8"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Nov 2016 12:16:03 +0100
parents b1291df2f780
children dd609a99d39a
comparison
equal deleted inserted replaced
2117:87b395a77c41 2118:9cf176bc21ad
92 if (convertJsonToXml_) 92 if (convertJsonToXml_)
93 { 93 {
94 #if ORTHANC_PUGIXML_ENABLED == 1 94 #if ORTHANC_PUGIXML_ENABLED == 1
95 std::string s; 95 std::string s;
96 Toolbox::JsonToXml(s, value); 96 Toolbox::JsonToXml(s, value);
97 output_.SetContentType("application/xml"); 97 output_.SetContentType("application/xml; charset=utf-8");
98 output_.Answer(s); 98 output_.Answer(s);
99 #else 99 #else
100 LOG(ERROR) << "Orthanc was compiled without XML support"; 100 LOG(ERROR) << "Orthanc was compiled without XML support";
101 throw OrthancException(ErrorCode_InternalError); 101 throw OrthancException(ErrorCode_InternalError);
102 #endif 102 #endif
103 } 103 }
104 else 104 else
105 { 105 {
106 Json::StyledWriter writer; 106 Json::StyledWriter writer;
107 output_.SetContentType("application/json"); 107 output_.SetContentType("application/json; charset=utf-8");
108 output_.Answer(writer.write(value)); 108 output_.Answer(writer.write(value));
109 } 109 }
110 110
111 alreadySent_ = true; 111 alreadySent_ = true;
112 } 112 }