Speaking of Symbian development, we have to mention the depressing descriptor in Symbian. Symbian introduces a series of mechanisms to improve stability, and descriptors are also one of them. From tdesc to rbuf, from the 16-bit Unicode to the 8-bit UTF-8, the unclear relationship between the chaos not only makes the new Symbian headache, but also in the Symbian Master feel ashamed.
Compared with Symbian descriptors, QT can be a big comfort for character applications in UNICODE, UTF-8, and even other encoding formats. Generally, Unicode in QT and Rich Text processing are divided into two major parts. This article focuses on Unicode in QT.
Unicode in QT can be very simple. From a 16-bit qstring to an 8-bit qbytearray, complicated descriptor problems in Symbian can be solved. Of course, qbytearray can not only be used as the encoding of the UTF-8, Unicode, binary, ASCII can be. Unicode in QT also provides good support for C-style strings.
From Symbian to QT to C style, new contacts may face a large number of Apis but do not know how to call them. Here are some of the more common usage:
1. qstring to const char *: qstring: tolocal8bit (): constdata ()
2. A series of toxxx () APIs
3. qbytearray can be used for binary file reading or network data storage.
4. Const char * or qstring parameters will be used in some classes in QT. If you can choose one, it is best to use qstring, such as qpixmap
5. the descriptor operations in Symbian are also relatively complex. If you use QT, you only need to know the usage of Arg and append.
6. For internationalization, the qtextcodec class is frequently used.