?? unicode.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - About Unicode</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }--></style></head><body bgcolor="#ffffff"><p><table width="100%"><tr><td><a href="index.html"><img width="100" height="100" src="qtlogo.png"alt="Home" border="0"><img width="100"height="100" src="face.png" alt="Home" border="0"></a><td valign="top"><div align="right"><img src="dochead.png" width="472" height="27"><br><a href="classes.html"><b>Classes</b></a>- <a href="annotated.html">Annotated</a>- <a href="hierarchy.html">Tree</a>- <a href="functions.html">Functions</a>- <a href="index.html">Home</a>- <a href="topicals.html"><b>Structure</b> <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qte</font></a></div></table><h1 align="center"> About Unicode</h1><br clear="all">Unicode is a 16-bit character set, portable across all major computingplatforms and with decent coverage of almost all of the world. It isalso single-locale; it includes no code pages or other complexitiesthat make software harder to write and test. Finally, there isnothing else that's reasonably cross-platform. For these reasons,Trolltech has chosen to make Unicode the native character set of Qtstarting with version 2.0.<p><p><b>Information about Unicode on the web.</b> The<a class="r" href="http://www.unicode.org">Unicode Consortium</a> has a numberof documents available, including<ul><li><a class="r" 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><p><b>The Standard.</b> The current version of the standard is 3.0.0. <ul><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.<li><a href="http://www.amazon.com/exec/obidos/ASIN/0201616335/trolltech/t">The Unicode Standard, version 3.0.</a> See also<a href="http://www.unicode.org/unicode/standard/versions/Unicode3.0.html">its home page.</a><p></ul><p><b>As used in Qt.</b> In Qt, and in most applications that use Qt,most or all user-visible strings are stored in Unicode, and Qtprovides <ul><li> Translation to/from legacy encodings for file I/O - see <a href="qtextcodec.html">QTextCodec</a> and <a href="qtextstream.html">QTextStream</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="qstring.html">QString</a>, that stores Unicode characters, withsupport for migrating from C strings including fast (cached)translation to and from the US-ASCII, and all the usual stringoperations<li> Unicode-aware widgets where necessary<li> On Windows 95/98/NT/2000, Unicode support detection, so that Qtprovides Unicode even on Windows platforms that do not support it<p></ul><p>To obtain the benefits of Unicode, we recommend using QString forstoring all user-visible strings and do all text file I/O usingQTextStream. Use <a href="qkeyevent.html#882dd8">QKeyEvent::text()</a> for keyboard input in anycustom widgets you write; it does not make much difference for slowtypists in West Europe or North America, but for fast typists orpeople using special input methods using text() is beneficial.<p>All the function arguments in Qt that may be user-visible strings, <a href="qlabel.html#bc5ea6">QLabel::setText()</a> and a thousand others, take <code>const</code> <code>QString</code> <code>&</code>as type. <a href="qstring.html">QString</a> provides implicit casting from <code>const</code> <code>char</code><code>*</code> such that things like<p><pre> myLabel->setText( "Hello, Dolly!" );</pre><p>will work. There is also a function, <a href="qobject.html#2418a9">QObject::tr()</a>, that providestranslation support, like this:<p><pre> myLabel->setText( tr("Hello, Dolly!") );</pre><p>tr(), oversimplifying a bit, maps from <code>const</code> <code>char</code> <code>*</code> to aUnicode string, and uses installable <a href="qtranslator.html">QTranslator</a> objects to do themapping.<p>Turning back to Unicode, for programs that needs to talk to otherprograms or read/write files in legacy file formats, Qt provides anumber of built-in <a href="qtextcodec.html">QTextCodec</a> classes, that is, classes that knowhow to translate between Unicode and a legacy encoding.<p>By default, conversion to/from <code>const</code> <code>char</code> <code>*</code> uses alocale-dependent codec. However, the program can easily find codecsfor other locales, and set any open file or network connection to usea special codec. It is also possible to install new codecs, forencodings that the built-in ones do not support. (At the time ofwriting, Vietnamese/VISCII is one example of that.)<p>Since US-ASCII and ISO-8859-1 are so common, there are also speciallyfast functions for mapping to and from them. For example, to open anapplication's icon one might do this:<p><pre> <a href="qfile.html">QFile</a> f( <a href="qstring.html#0b1906">QString::fromLatin1</a>("appicon.png") );</pre><p>Regarding output, Qt will do a best-effort conversion from Unicode towhatever encoding the system and fonts provide. Depending onoperating system, locale, font availability and Qt's support for thecharacters used, this conversion may be good or bad. We aim to extendthis in upcoming versions, with emphasis on the most common localesfirst.<p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -