Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 1557:ad1e127b4ed5
fix in encodings
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Aug 2015 17:29:42 +0200 |
parents | d6a93e12b1c1 |
children | 124de28b32ed |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Aug 20 17:05:05 2015 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Aug 20 17:29:42 2015 +0200 @@ -37,6 +37,7 @@ #include "../../Core/Uuid.h" #include "../FromDcmtkBridge.h" #include "../ServerContext.h" +#include "../OrthancInitialization.h" namespace Orthanc { @@ -476,6 +477,19 @@ return false; } + std::string tmp; + if (request["Tags"].isMember("SpecificCharacterSet")) + { + tmp = request["Tags"]["SpecificCharacterSet"].asString(); + } + else + { + tmp = Configuration::GetGlobalStringParameter("DefaultEncoding", "Latin1"); + } + + Encoding encoding = StringToEncoding(tmp.c_str()); + dicom.SetEncoding(encoding); + ResourceType parentType = ResourceType_Instance; if (request.isMember("Parent")) @@ -549,7 +563,8 @@ } else if (tag["Type"] == "String") { - dicom.Replace(*it, tag["Value"].asString()); + std::string value = tag["Value"].asString(); + dicom.Replace(*it, Toolbox::ConvertFromUtf8(value, encoding)); } } } @@ -609,7 +624,7 @@ } else { - dicom.Replace(tag, value); + dicom.Replace(tag, Toolbox::ConvertFromUtf8(value, encoding)); } }