<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt - 3.3.8 - espenr - 2499/qt - x11 - free - 3.3.8/doc/unicode.doc:36 -->
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > About Unicode< / title >
< style type = "text/css" > < ! - -
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
-->< / style >
< / head >
< body >
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" >
< tr bgcolor = "#E5E5E5" >
< td valign = center >
< a href = "index.html" >
< font color = "#004faf" > Home< / font > < / a >
| < a href = "classes.html" >
< font color = "#004faf" > All Classes< / font > < / a >
| < a href = "mainclasses.html" >
< font color = "#004faf" > Main Classes< / font > < / a >
| < a href = "annotated.html" >
< font color = "#004faf" > Annotated< / font > < / a >
| < a href = "groups.html" >
< font color = "#004faf" > Grouped Classes< / font > < / a >
| < a href = "functions.html" >
< font color = "#004faf" > Functions< / font > < / a >
< / td >
< td align = "right" valign = "center" > < img src = "logo32.png" align = "right" width = "64" height = "32" border = "0" > < / td > < / tr > < / table > < h1 align = center > About Unicode< / 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 multiplatform. For these
reasons, Trolltech uses Unicode as the native character set for TQt
(since version 2.0).
< p > < h2 > Information about Unicode on the web.
< / h2 >
< a name = "1" > < / a > < p > The < a href = "http://www.unicode.org" > Unicode Consortium< / a >
has a number of documents available, including
< p > < ul >
< p > < li > < a href = "http://www.unicode.org/unicode/standard/principles.html" > A technical introduction to Unicode< / a >
< li > < a href = "http://www.unicode.org/unicode/standard/standard.html" > The home page for the standard< / a >
< p > < / ul >
< p > < h2 > The Standard
< / h2 >
< a name = "2" > < / a > < p > The current version of the standard is 3.2
< p > < ul >
< p > < li > < a href = "http://www.amazon.com/exec/obidos/ASIN/0201616335/trolltech/t" > The Unicode Standard, version 3.2.< / a > See also
< a href = "http://www.unicode.org/unicode/standard/versions/" > its home page.< / a >
< li > < a href = "http://www.amazon.com/exec/obidos/ASIN/0201473459/trolltech/t" > The Unicode Standard, version 2.0.< / a > See also the
< a href = "http://www.unicode.org/unicode/reports/tr8.html" > 2.1
update< / a > and
< a href = "http://www.unicode.org/unicode/standard/versions/enumeratedversions.html#Unicode" > 2.1.9 the 2.1.9 data files< / a > at www.unicode.org.
< p > < / ul >
< p > < h2 > Unicode in TQt
< / h2 >
< a name = "3" > < / a > < p > In TQt, and in most applications that use TQt, most or all user-visible
strings are stored using Unicode. TQt provides:
< p > < ul >
< p > < li > Translation to/from legacy encodings for file I/O: see < a href = "ntqtextcodec.html" > TQTextCodec< / a > and < a href = "ntqtextstream.html" > TQTextStream< / a > .
< li > Translation from Input Methods and 8-bit keyboard input.
< li > Translation to legacy character sets for on-screen display.
< li > A string class, < a href = "ntqstring.html" > TQString< / 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 > Unicode-aware widgets where appropriate.
< li > Unicode support detection on Windows, so that TQt provides Unicode
even on Windows platforms that do not support it natively.
< p > < / ul >
< p > To fully benefit from Unicode, we recommend using < a href = "ntqstring.html" > TQString< / a > for storing
all user-visible strings, and performing all text file I/O using
< a href = "ntqtextstream.html" > TQTextStream< / a > . Use < a href = "qkeyevent.html#text" > TQKeyEvent::text< / a > () 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 > All the function arguments in TQt that may be user-visible strings, < a href = "ntqlabel.html#setText" > TQLabel::setText< / a > () and a many others, take < tt > const TQString & < / tt > s.
< a href = "ntqstring.html" > TQString< / a > provides implicit casting from < tt > const char *< / tt >
so that things like
< pre >
myLabel-> setText( "Hello, Dolly!" );
< / pre >
will work. There is also a function, < a href = "ntqobject.html#tr" > TQObject::tr< / a > (), that provides
translation support, like this:
< pre >
myLabel-> setText( tr("Hello, Dolly!") );
< / pre >
< p > tr() (simplifying somewhat) maps from < tt > const char *< / tt > to a
Unicode string, and uses installable < a href = "ntqtranslator.html" > TQTranslator< / a > objects to do the
mapping.
< p > TQt provides a number of built-in < a href = "ntqtextcodec.html" > TQTextCodec< / 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 > 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 > 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:
< pre >
< a href = "ntqfile.html" > TQFile< / a > f( TQString::< a href = "ntqstring.html#fromLatin1" > fromLatin1< / a > ("appicon.png") );
< / pre >
< p > Regarding output, TQt will do a best-effort conversion from
Unicode to whatever encoding the system and fonts provide.
Depending on operating system, locale, font availability and TQt'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 >
<!-- eof -->
< p > < address > < hr > < div align = center >
< table width = 100% cellspacing = 0 border = 0 > < tr >
< td > Copyright © 2007
< a href = "troll.html" > Trolltech< / a > < td align = center > < a href = "trademarks.html" > Trademarks< / a >
< td align = right > < div align = right > TQt 3.3.8< / div >
< / table > < / div > < / address > < / body >
< / html >