73
|
1 .. _implementation-notes:
|
|
2
|
|
3 Implementation notes
|
|
4 ====================
|
|
5
|
|
6 Encodings
|
|
7 ---------
|
|
8
|
|
9 DICOM supports many codepages to encode strings. DICOM instances using
|
|
10 special characters should contain the ``SpecificCharacterSet
|
|
11 (0008,0005)`` tag. The latter tag `specifies which codepage
|
|
12 <http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.12.html#sect_C.12.1.1.2>`__
|
|
13 is used by the DICOM instance. Internally, Orthanc converts all these
|
|
14 codepages to the `UTF-8 encoding
|
74
|
15 <https://en.wikipedia.org/wiki/UTF-8>`__ (cf. the
|
|
16 ``Orthanc::ParsedDicomFile`` class).
|
73
|
17
|
|
18 In particular, :ref:`plugins <creating-plugins>` must assume that any
|
|
19 string or JSON file coming from the Orthanc core is encoded using
|
|
20 UTF-8. Similarly, plugins must use UTF-8 when calling services
|
|
21 provided by the Orthanc core. The conversion to/from UTF-8 is done
|
|
22 transparently by the plugin engine.
|
|
23
|
|
24 The :ref:`configuration option <configuration>` ``DefaultEncoding``
|
|
25 plays an important role. It is used in three cases:
|
|
26
|
|
27 1. If receiving a DICOM instance without the ``SpecificCharacterSet
|
|
28 (0008,0005)`` tag, Orthanc will interpret strings within this
|
|
29 instance using this default encoding. This is important in
|
|
30 practice, as many DICOM modalities are not properly configured with
|
|
31 respect to encodings.
|
|
32
|
|
33 2. When answering a :ref:`C-Find query <dicom-find>` (including for
|
|
34 worklists), Orthanc will use its default encoding. If one single
|
|
35 answer uses a different encoding, it will be transcoded.
|
|
36
|
|
37 3. If creating a new instance (e.g. through the
|
|
38 ``/tools/create-dicom`` URI of the :ref:`REST API <rest>`, or
|
|
39 through the ``OrthancPluginCreateDicom()`` primitive of the plugin
|
|
40 SDK) and if ``SpecificCharacterSet (0008,0005)`` is not provided
|
|
41 for this instance, Orthanc will use its default encoding. Note
|
|
42 however that if ``SpecificCharacterSet`` is set, Orthanc will
|
|
43 transcode the incoming UTF-8 strings to the codepage specified in
|
|
44 this tag, and not to the default encoding.
|