The QText Codec class provides conversions between text encodings.Qt uses Unicode to store, draw and manipulate strings.
Qt provides a set of QText Codec classes to help with converting non-Unicode formats to and from Unicode. The supported encodings are: If Qt is compiled with ICU support enabled, most codecs supported by ICU will also be available to the application.
QText Codecs can be used as follows to convert some locally encoded string to Unicode.
For example, "ISO-8859-1" has "latin1", "CP819", "IBM819", and "iso-ir-100" as aliases.). If the codec cannot be detected from the content provided, default Codec is returned. Returns a pointer to the codec most suitable for this locale.
Qt takes ownership and will delete it when the application terminates. Note that you should not delete codecs yourself: once created they become Qt's responsibility. Subclasses can return a number of aliases for the codec in question. Call QText Codec::codec For Mib() to obtain the QText Codec for the MIB. On Windows, the codec will be based on a system locale.
Set the codec to c; this will be returned by codec For Locale(). Converts the first size characters from the input from the encoding of this codec to Unicode, and returns the result in a QString. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
If c is a null pointer, the codec is reset to the default. Converts a from the encoding of this codec to Unicode, and returns the result in a QString. Qt and respective logos are trademarks of The Qt Company Ltd. All other trademarks are property of their respective owners.Returns 0 if no codec matching the name name could be found. Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QText Codec instance that is capable of decoding the text to unicode.Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QText Codec instance that is capable of decoding the text to unicode. If the codec cannot be detected, this overload returns a Latin-1 QText Codec. QText Codec subclasses must reimplement this function.In such cases it is possible that a multi-byte character will be split over two chunks.At best this might result in the loss of a character and at worst cause the entire conversion to fail.The approach to use in these situations is to create a QText Decoder object for the codec and use this QText Decoder for the whole decoding process, as shown below: The QText Decoder object maintains state between chunks and therefore works correctly even if a multi-byte character is split between chunks.