| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>Internationalization: libiptcdata Reference Manual</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| 7 | <link rel="home" href="index.html" title="libiptcdata Reference Manual"> |
| 8 | <link rel="up" href="index.html" title="libiptcdata Reference Manual"> |
| 9 | <link rel="prev" href="iptc-libjpeg.html" title="libjpeg Interoperability"> |
| 10 | <link rel="next" href="ch01.html" title="IPTC Data Manipulation"> |
| 11 | <meta name="generator" content="GTK-Doc V1.28 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> |
| 16 | <td width="100%" align="left" class="shortcuts"></td> |
| 17 | <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| 18 | <td><img src="up-insensitive.png" width="16" height="16" border="0"></td> |
| 19 | <td><a accesskey="p" href="iptc-libjpeg.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| 20 | <td><a accesskey="n" href="ch01.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| 21 | </tr></table> |
| 22 | <div class="refentry"> |
| 23 | <a name="iptc-i18n"></a><div class="titlepage"></div> |
| 24 | <div class="refnamediv"><table width="100%"><tr> |
| 25 | <td valign="top"> |
| 26 | <h2><span class="refentrytitle">Internationalization</span></h2> |
| 27 | <p>Internationalization — using extended character sets with a libiptcdata application</p> |
| 28 | </td> |
| 29 | <td class="gallery_image" valign="top" align="right"></td> |
| 30 | </tr></table></div> |
| 31 | <div class="refsect1"> |
| 32 | <a name="i18n"></a><h2>Supporting Internationalization with libiptcdata</h2> |
| 33 | <p> |
| 34 | The IPTC IIM standard supports storing data with nearly any |
| 35 | character set. According to the standard, the data of |
| 36 | Record 1 should be in plain ASCII, but data of the following |
| 37 | records should follow the character set established by |
| 38 | dataset 1:90, the "character set" dataset. This dataset |
| 39 | contains control functions according to the ISO 2022 |
| 40 | standard, which allow for switching between different |
| 41 | character sets. However, there are several problems with this |
| 42 | approach: |
| 43 | </p> |
| 44 | <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| 45 | <li class="listitem"><p> |
| 46 | Nearly all IPTC-aware applications written previously do not |
| 47 | follow this standard. They usually force all characters to |
| 48 | ASCII or use the Latin-1 character set, without identifying |
| 49 | it in dataset 1:90. |
| 50 | </p></li> |
| 51 | <li class="listitem"><p> |
| 52 | The ISO 2022 standard is very complicated and lacks a free |
| 53 | reference implementation. In addition, the standard |
| 54 | is rarely used since Unicode provides a superior |
| 55 | alternative. |
| 56 | </p></li> |
| 57 | </ul></div> |
| 58 | <p> |
| 59 | </p> |
| 60 | <p> |
| 61 | libiptcdata does not implement the complete ISO 2022 standard (in |
| 62 | fact, it implements almost none of it), but can still be used |
| 63 | successfully with multiple character sets. Here's how: |
| 64 | </p> |
| 65 | <div class="orderedlist"><ol class="orderedlist" type="1"> |
| 66 | <li class="listitem"><p> |
| 67 | When IPTC data is added to an image file for the first time, |
| 68 | always store data in the UTF-8 character set. It is the |
| 69 | responsibility of the application to make sure that the |
| 70 | <a class="link" href="libiptcdata-dataset.html#iptc-dataset-set-data" title="iptc_dataset_set_data ()"><code class="function">iptc_dataset_set_data()</code></a> |
| 71 | function is always called with UTF-8 |
| 72 | encoded data. This generally happens automatically with |
| 73 | modern toolkits such as gtk+. The application should call |
| 74 | <a class="link" href="libiptcdata-data.html#iptc-data-set-encoding-utf8" title="iptc_data_set_encoding_utf8 ()"><code class="function">iptc_data_set_encoding_utf8()</code></a> |
| 75 | which sets the value of dataset 1:90, indicating that UTF-8 is |
| 76 | being used. |
| 77 | </p></li> |
| 78 | <li class="listitem"><p> |
| 79 | When reading or modifying IPTC data saved by another application, |
| 80 | first use the |
| 81 | <a class="link" href="libiptcdata-data.html#iptc-data-get-encoding" title="iptc_data_get_encoding ()"><code class="function">iptc_data_get_encoding()</code></a> |
| 82 | function to find out what encoding the data has been stored in. |
| 83 | If it's not UTF-8, it may be hard to identify the character set, |
| 84 | since the ISO 2022 standard is generally not followed. Often, |
| 85 | a good guess is ISO-8859-1. However, if new data is added, it is |
| 86 | probably wise to start using the UTF-8 encoding. |
| 87 | </p></li> |
| 88 | </ol></div> |
| 89 | <p> |
| 90 | </p> |
| 91 | </div> |
| 92 | </div> |
| 93 | <div class="footer"> |
| 94 | <hr>Generated by GTK-Doc V1.28</div> |
| 95 | </body> |
| 96 | </html> |