diff OrthancFramework/Sources/Enumerations.cpp @ 5291:800261398381

Made Orthanc more resilient to common spelling errors in SpecificCharacterSet
author Alain Mazy <am@osimis.io>
date Tue, 09 May 2023 17:48:33 +0200
parents 0ea402b4d901
children f26ed26a7793 5b2a5cc64cb1
line wrap: on
line diff
--- a/OrthancFramework/Sources/Enumerations.cpp	Fri May 05 09:03:04 2023 +0200
+++ b/OrthancFramework/Sources/Enumerations.cpp	Tue May 09 17:48:33 2023 +0200
@@ -31,6 +31,7 @@
 #include <boost/thread/mutex.hpp>
 #include <string.h>
 #include <cassert>
+#include <boost/algorithm/string/replace.hpp>
 
 namespace Orthanc
 {
@@ -1933,6 +1934,11 @@
     std::string s = Toolbox::StripSpaces(specificCharacterSet);
     Toolbox::ToUpperCase(s);
 
+    // handle common spelling mistakes
+    boost::replace_all(s, "ISO_IR_", "ISO_IR ");
+    boost::replace_all(s, "ISO_2022_IR_", "ISO 2022 IR ");
+
+
     // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
     // https://github.com/dcm4che/dcm4che/blob/master/dcm4che-core/src/main/java/org/dcm4che3/data/SpecificCharacterSet.java
     if (s == "ISO_IR 6" ||