comparison OrthancServer/FromDcmtkBridge.cpp @ 1090:e494ceb8d763

support more encodings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Aug 2014 12:04:23 +0200
parents e07b90fb00eb
children 552a038f7c96
comparison
equal deleted inserted replaced
1089:5ea0b56e850d 1090:e494ceb8d763
126 126
127 OFString tmp; 127 OFString tmp;
128 if (dataset.findAndGetOFString(DCM_SpecificCharacterSet, tmp).good()) 128 if (dataset.findAndGetOFString(DCM_SpecificCharacterSet, tmp).good())
129 { 129 {
130 std::string characterSet = Toolbox::StripSpaces(std::string(tmp.c_str())); 130 std::string characterSet = Toolbox::StripSpaces(std::string(tmp.c_str()));
131 Toolbox::ToUpperCase(characterSet); 131
132 132 if (characterSet.empty())
133 if (characterSet == "ISO_IR 6" || 133 {
134 characterSet == "ISO_IR 192") 134 // Empty specific character set tag: Use the default encoding
135 { 135 }
136 encoding = Encoding_Utf8; 136 else if (GetDicomEncoding(encoding, characterSet.c_str()))
137 } 137 {
138 else if (characterSet == "ISO_IR 100") 138 // The specific character set is supported by the Orthanc core
139 { 139 }
140 encoding = Encoding_Latin1; 140 else
141 } 141 {
142 else if (characterSet == "ISO_IR 101") 142 LOG(WARNING) << "Value of Specific Character Set (0008,0005) is not supported: " << characterSet
143 { 143 << ", fallback to ASCII (remove all special characters)";
144 encoding = Encoding_Latin2;
145 }
146 else if (characterSet == "ISO_IR 109")
147 {
148 encoding = Encoding_Latin3;
149 }
150 else if (characterSet == "ISO_IR 110")
151 {
152 encoding = Encoding_Latin4;
153 }
154 else if (characterSet == "ISO_IR 148")
155 {
156 encoding = Encoding_Latin5;
157 }
158 else if (characterSet == "ISO_IR 144")
159 {
160 encoding = Encoding_Cyrillic;
161 }
162 else if (characterSet == "ISO_IR 127")
163 {
164 encoding = Encoding_Arabic;
165 }
166 else if (characterSet == "ISO_IR 126")
167 {
168 encoding = Encoding_Greek;
169 }
170 else if (characterSet == "ISO_IR 138")
171 {
172 encoding = Encoding_Hebrew;
173 }
174 else if (!characterSet.empty())
175 {
176 LOG(WARNING) << "Value of Specific Character Set (0008,0005) is not supported: " << characterSet;
177 // Fallback to ASCII (remove all special characters)
178 encoding = Encoding_Ascii; 144 encoding = Encoding_Ascii;
179 } 145 }
146 }
147 else
148 {
149 // No specific character set tag: Use the default encoding
180 } 150 }
181 151
182 return encoding; 152 return encoding;
183 } 153 }
184 154