changeset 3448:b3bdd6dc10f2

don't change encoding of SpecificCharacterSet
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Jun 2019 14:18:46 +0200
parents d30668b1a44a
children 90140b7796a1 bab2a84a6697
files Core/DicomParsing/DicomWebJsonVisitor.cpp Core/DicomParsing/FromDcmtkBridge.cpp
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jun 25 12:15:03 2019 +0200
+++ b/Core/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jun 25 14:18:46 2019 +0200
@@ -558,9 +558,9 @@
               tokens.size() > 1 &&
               tokens[0].empty())
           {
-            std::string s = tokens[1];
-            tokens.clear();
-            tokens.push_back(s);
+            // Specific character set with code extension: Remove the
+            // first element from the vector of encodings
+            tokens.erase(tokens.begin());
           }
 
           node[KEY_VALUE] = Json::arrayValue;
--- a/Core/DicomParsing/FromDcmtkBridge.cpp	Tue Jun 25 12:15:03 2019 +0200
+++ b/Core/DicomParsing/FromDcmtkBridge.cpp	Tue Jun 25 14:18:46 2019 +0200
@@ -2312,8 +2312,15 @@
 
       if (c != NULL)  // This case corresponds to the empty string
       {
-        std::string s(c);
-        utf8 = Toolbox::ConvertToUtf8(s, encoding, hasCodeExtensions);
+        if (element.getTag() == DCM_SpecificCharacterSet)
+        {
+          utf8.assign(c);
+        }
+        else
+        {
+          std::string s(c);
+          utf8 = Toolbox::ConvertToUtf8(s, encoding, hasCodeExtensions);
+        }
       }
 
       std::string newValue;