diff 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
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon Aug 04 12:16:50 2014 +0200
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon Aug 04 17:57:45 2014 +0200
@@ -41,6 +41,7 @@
 
 #include "FromDcmtkBridge.h"
 #include "ToDcmtkBridge.h"
+#include "OrthancInitialization.h"
 #include "../Core/Toolbox.h"
 #include "../Core/OrthancException.h"
 #include "../Core/ImageFormats/PngWriter.h"
@@ -119,8 +120,9 @@
 
   Encoding FromDcmtkBridge::DetectEncoding(DcmDataset& dataset)
   {
-    // By default, assume UTF-8 encoding (as in dcm2xml.cc)
-    Encoding encoding = Encoding_Utf8;
+    // By default, Ascii encoding is assumed (this removes all the special charaters)
+    std::string s = Configuration::GetGlobalStringParameter("DefaultEncoding", "");
+    Encoding encoding = s.empty() ? Encoding_Ascii : StringToEncoding(s.c_str());
 
     OFString tmp;
     if (dataset.findAndGetOFString(DCM_SpecificCharacterSet, tmp).good())