# HG changeset patch # User Alain Mazy # Date 1793803165 -3600 # Node ID abb0321e1aebac85f51090eb3cfb1307f6dc2597 # Parent d2109836f70db8a7e0a7c49851ee90540d22ccc1 modifying the SpecificCharacterSet now changes the encoding of all texts in the DICOM file diff -r d2109836f70d -r abb0321e1aeb NEWS --- a/NEWS Wed Nov 04 11:35:21 2026 +0100 +++ b/NEWS Wed Nov 04 15:39:25 2026 +0100 @@ -8,6 +8,9 @@ - Optimized some queries to access single resources. - Added/updated 2 indexes: the first startup with this version migth be slower to rebuild these indexes. +* It is now possible to change the encoding of all texts in a DICOM file by modifying its + SpecificCharacterSet when calling /modify. + (https://github.com/orthanc-server/orthanc-explorer-2/issues/123) Plugin SDK ---------- diff -r d2109836f70d -r abb0321e1aeb OrthancFramework/Sources/DicomParsing/DicomModification.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Nov 04 11:35:21 2026 +0100 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Nov 04 15:39:25 2026 +0100 @@ -1084,7 +1084,21 @@ toModify->Remove(*it); } - // (5) Replace the tags + // (5.0) Change the encoding before replacing new values + if (IsReplaced(DICOM_TAG_SPECIFIC_CHARACTER_SET)) + { + std::string targetEncodingStr = GetReplacementAsString(DICOM_TAG_SPECIFIC_CHARACTER_SET); + Encoding targetEncoding; + + if (!GetDicomEncoding(targetEncoding, targetEncodingStr.c_str())) + { + throw OrthancException(ErrorCode_BadRequest, std::string("Unrecognized SpecificCharacterSet, unable to modify the encoding: ") + targetEncodingStr); + } + + toModify->ChangeEncoding(targetEncoding); + } + + // (5.1) Replace the tags for (Replacements::const_iterator it = replacements_.begin(); it != replacements_.end(); ++it) {