comparison OrthancServer/FromDcmtkBridge.cpp @ 1086:e56c3ed8d738

Parameter to set the default encoding for DICOM files without SpecificCharacterSet
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Aug 2014 17:57:45 +0200
parents a226e0959d8b
children e07b90fb00eb
comparison
equal deleted inserted replaced
1085:b161593551db 1086:e56c3ed8d738
39 39
40 #include "Internals/DicomImageDecoder.h" 40 #include "Internals/DicomImageDecoder.h"
41 41
42 #include "FromDcmtkBridge.h" 42 #include "FromDcmtkBridge.h"
43 #include "ToDcmtkBridge.h" 43 #include "ToDcmtkBridge.h"
44 #include "OrthancInitialization.h"
44 #include "../Core/Toolbox.h" 45 #include "../Core/Toolbox.h"
45 #include "../Core/OrthancException.h" 46 #include "../Core/OrthancException.h"
46 #include "../Core/ImageFormats/PngWriter.h" 47 #include "../Core/ImageFormats/PngWriter.h"
47 #include "../Core/Uuid.h" 48 #include "../Core/Uuid.h"
48 #include "../Core/DicomFormat/DicomString.h" 49 #include "../Core/DicomFormat/DicomString.h"
117 } 118 }
118 119
119 120
120 Encoding FromDcmtkBridge::DetectEncoding(DcmDataset& dataset) 121 Encoding FromDcmtkBridge::DetectEncoding(DcmDataset& dataset)
121 { 122 {
122 // By default, assume UTF-8 encoding (as in dcm2xml.cc) 123 // By default, Ascii encoding is assumed (this removes all the special charaters)
123 Encoding encoding = Encoding_Utf8; 124 std::string s = Configuration::GetGlobalStringParameter("DefaultEncoding", "");
125 Encoding encoding = s.empty() ? Encoding_Ascii : StringToEncoding(s.c_str());
124 126
125 OFString tmp; 127 OFString tmp;
126 if (dataset.findAndGetOFString(DCM_SpecificCharacterSet, tmp).good()) 128 if (dataset.findAndGetOFString(DCM_SpecificCharacterSet, tmp).good())
127 { 129 {
128 std::string characterSet = Toolbox::StripSpaces(std::string(tmp.c_str())); 130 std::string characterSet = Toolbox::StripSpaces(std::string(tmp.c_str()));