Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2550

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /home/gvatteka/dev/qt-4.3/doc/src/unicode.qdoc -->
<head>
  <title>Unicode</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Unicode<br /><small></small></h1>
<p>Unicode is a multi-byte character set, portable across all major computing platforms and with decent coverage over most of the world. It is also single-locale; it includes no code pages or other complexities that make software harder to write and test. There is no competing character set that's reasonably cross-platform. For these reasons, Trolltech uses Unicode 4.0 as the native character set for Qt.</p>
<a name="information-about-unicode-on-the-web"></a>
<h3>Information about Unicode on the Web</h3>
<p>The <a href="http://www.unicode.org/">Unicode Consortium</tt></a> has a number of documents available, including</p>
<ul>
<li><a href="http://www.unicode.org/unicode/standard/principles.html">A technical introduction to Unicode</tt></a></li>
<li><a href="http://www.unicode.org/unicode/standard/standard.html">The home page for the standard</tt></a></li>
</ul>
<a name="the-standard"></a>
<h3>The Standard</h3>
<p>The current version of the standard is 4.0&#x2e;0&#x2e;</p>
<ul>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0321185781/trolltech/t">The Unicode Standard, version 4.0&#x2e;</tt></a> See also <a href="http://www.unicode.org/unicode/standard/versions/">its home page.</tt></a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0201616335/trolltech/t">The Unicode Standard, version 3.2&#x2e;</tt></a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0201473459/trolltech/t">The Unicode Standard, version 2.0&#x2e;</tt></a> See also the <a href="http://www.unicode.org/unicode/reports/tr8.html">2.1 update</tt></a> and <a href="http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode">2.1&#x2e;9 the 2.1&#x2e;9 data files</tt></a> at www.unicode.org.</li>
</ul>
<a name="unicode-in-qt"></a>
<h3>Unicode in Qt</h3>
<p>In Qt, and in most applications that use Qt, most or all user-visible strings are stored using Unicode. Qt provides:</p>
<ul>
<li>Translation to/from legacy encodings for file I/O: see <a href="core/QTextCodec.html"><tt>QTextCodec</tt></a> and <a href="core/QTextStream.html"><tt>QTextStream</tt></a>.</li>
<li>Translation from Input Methods and 8-bit keyboard input.</li>
<li>Translation to legacy character sets for on-screen display.</li>
<li>A string class, <a href="porting4.html#qstring"><tt>QString</tt></a>, that stores Unicode characters, with support for migrating from C strings including fast (cached) translation to and from US-ASCII, and all the usual string operations.</li>
<li>Unicode-aware widgets where appropriate.</li>
<li>Unicode support detection on Windows, so that Qt provides Unicode even on Windows platforms that do not support it natively.</li>
</ul>
<p>To fully benefit from Unicode, we recommend using <a href="porting4.html#qstring"><tt>QString</tt></a> for storing all user-visible strings, and performing all text file I/O using <a href="core/QTextStream.html"><tt>QTextStream</tt></a>. Use QKeyEvent::text() for keyboard input in any custom widgets you write; it does not make much difference for slow typists in Western Europe or North America, but for fast typists or people using special input methods using text() is beneficial.</p>
<p>All the function arguments in Qt that may be user-visible strings, QLabel::setText() and a many others, take <tt>const QString &amp;</tt>s. <a href="porting4.html#qstring"><tt>QString</tt></a> provides implicit casting from <tt>const char *</tt> so that things like</p>
<pre>    label-&gt;setText(&quot;Password:&quot;);</pre>
<p>will work. There is also a function, QObject::tr(), that provides translation support, like this:</p>
<pre>    label-&gt;setText(tr(&quot;Password:&quot;));</pre>
<p>QObject::tr() maps from <tt>const char *</tt> to a Unicode string, and uses installable <a href="core/QTranslator.html"><tt>QTranslator</tt></a> objects to do the mapping.</p>
<p>Qt provides a number of built-in <a href="core/QTextCodec.html"><tt>QTextCodec</tt></a> classes, that is, classes that know how to translate between Unicode and legacy encodings to support programs that must talk to other programs or read/write files in legacy file formats.</p>
<p>By default, conversion to/from <tt>const char *</tt> uses a locale-dependent codec. However, applications can easily find codecs for other locales, and set any open file or network connection to use a special codec. It is also possible to install new codecs, for encodings that the built-in ones do not support. (At the time of writing, Vietnamese/VISCII is one such example.)</p>
<p>Since US-ASCII and ISO-8859-1 are so common, there are also especially fast functions for mapping to and from them. For example, to open an application's icon one might do this:</p>
<pre>    QFile file(QString::fromLatin1(&quot;appicon.png&quot;));</pre>
<p>or</p>
<pre>    QFile file(QLatin1String(&quot;appicon.png&quot;));</pre>
<p>Regarding output, Qt will do a best-effort conversion from Unicode to whatever encoding the system and fonts provide. Depending on operating system, locale, font availability, and Qt's support for the characters used, this conversion may be good or bad. We will extend this in upcoming versions, with emphasis on the most common locales first.</p>
<dl>
<dt><b>See Also:</b></dt>
<dd>Internationalization with Qt</tt></dd>
</dl>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2007 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Jambi </div></td>
</tr></table></div></address></body>
</html>