PythonQt.QtCore.QTextCodec · declarations 001
Back to PythonQt.QtCore.QTextCodec
ConversionFlag
instance-attribute
ConversionFlag: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
ConversionFlags
instance-attribute
ConversionFlags: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
ConvertInvalidToNull
instance-attribute
ConvertInvalidToNull: Any
DefaultConversion
instance-attribute
DefaultConversion: Any
FreeFunction
instance-attribute
FreeFunction: Any
IgnoreHeader
instance-attribute
IgnoreHeader: Any
aliases
aliases() -> Any
X.aliases()
Supplemental documentation: Qt 5 reference:
[virtual] QList\<QByteArray> QTextCodec::aliases() const
Subclasses can return a number of aliases for the codec in question.
Standard aliases for codecs can be found in the IANA character-sets encoding file.
Upstream PySide2 reference signatures (binding differences may apply):
aliases(self) -> typing.List[PySide2.QtCore.QByteArray]
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#aliases
availableCodecs
availableCodecs() -> Any
X.availableCodecs()
Supplemental documentation: Qt 5 reference:
[static] QList\<QByteArray> QTextCodec::availableCodecs()
Returns the list of all available codecs, by name. Call QTextCodec::codecForName() to obtain the QTextCodec for the name.
The list may contain many mentions of the same codec if the codec has aliases.
Note: This function is thread-safe.
See also availableMibs(), name(), and aliases().
Upstream PySide2 reference signatures (binding differences may apply):
availableCodecs() -> typing.List[PySide2.QtCore.QByteArray]
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#availableCodecs
availableMibs
availableMibs() -> tuple
X.availableMibs() -> tuple
Supplemental documentation: Qt 5 reference:
[static] QList\<int> QTextCodec::availableMibs()
Returns the list of MIBs for all available codecs. Call QTextCodec::codecForMib() to obtain the QTextCodec for the MIB.
Note: This function is thread-safe.
See also availableCodecs() and mibEnum().
Upstream PySide2 reference signatures (binding differences may apply):
availableMibs() -> typing.List[int]
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#availableMibs
canEncode
canEncode(arg__1: str) -> bool
X.canEncode(arg__1) -> bool
Supplemental documentation: Qt 5 reference:
bool QTextCodec::canEncode(QChar ch) const
Returns true if the Unicode character ch can be fully encoded with this codec;
otherwise returns false.
bool QTextCodec::canEncode(const QString \&s) const
This is an overloaded function.
s contains the string being tested for encode-ability.
bool QTextCodec::canEncode(QStringView s) const
This is an overloaded function.
Returns true if the Unicode string s can be fully encoded with this codec; otherwise
returns false.
This function was introduced in Qt 5.10.
Upstream PySide2 reference signatures (binding differences may apply):
canEncode(self, arg__1: str) -> bool
canEncode(self, arg__1: str) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#canEncode
codecForHtml
codecForHtml(ba: Any, defaultCodec: Any) -> Any
X.codecForHtml(ba, defaultCodec) -> PythonQt.QtCore.QTextCodec
Supplemental documentation: Qt 5 reference:
[static] QTextCodec *QTextCodec::codecForHtml(const QByteArray \&ba, QTextCodec *defaultCodec)
Tries to detect the encoding of the provided snippet of HTML in the given byte array, ba, by checking the BOM (Byte Order Mark) and the content-type meta header and returns a QTextCodec instance that is capable of decoding the html to unicode. If the codec cannot be detected from the content provided, defaultCodec is returned.
This function was introduced in Qt 4.4.
See also codecForUtfText().
[static] QTextCodec *QTextCodec::codecForHtml(const QByteArray \&ba)
This is an overloaded function.
Tries to detect the encoding of the provided snippet of HTML in the given byte array, ba, by checking the BOM (Byte Order Mark) and the content-type meta header and returns a QTextCodec instance that is capable of decoding the html to unicode. If the codec cannot be detected, this overload returns a Latin-1 QTextCodec.
Upstream PySide2 reference signatures (binding differences may apply):
codecForHtml(ba: PySide2.QtCore.QByteArray) -> PySide2.QtCore.QTextCodec
codecForHtml(ba: PySide2.QtCore.QByteArray, defaultCodec: PySide2.QtCore.QTextCodec) -> PySide2.QtCore.QTextCodec
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#codecForHtml
codecForLocale
codecForLocale() -> Any
X.codecForLocale() -> PythonQt.QtCore.QTextCodec
Supplemental documentation: Qt 5 reference:
[static] QTextCodec *QTextCodec::codecForLocale()
Returns a pointer to the codec most suitable for this locale.
The codec will be retrieved from ICU where that backend is in use, otherwise it may be obtained from an OS-specific API. In the latter case, the codec's name may be "System".
Note: This function is thread-safe.
See also setCodecForLocale().
Upstream PySide2 reference signatures (binding differences may apply):
codecForLocale() -> PySide2.QtCore.QTextCodec
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#codecForLocale
codecForMib
codecForMib(mib: int) -> Any
X.codecForMib(mib) -> PythonQt.QtCore.QTextCodec
Supplemental documentation: Qt 5 reference:
[static] QTextCodec *QTextCodec::codecForMib(int mib)
Returns the QTextCodec which matches the MIBenum mib.
Note: This function is thread-safe.
Upstream PySide2 reference signatures (binding differences may apply):
codecForMib(mib: int) -> PySide2.QtCore.QTextCodec
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#codecForMib
codecForName
codecForName(name: Any) -> Any
X.codecForName(name) -> PythonQt.QtCore.QTextCodec
Supplemental documentation: Qt 5 reference:
[static] QTextCodec *QTextCodec::codecForName(const QByteArray \&name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. Returns 0 if no codec matching the name name could be found.
Note: This function is thread-safe.
[static] QTextCodec *QTextCodec::codecForName(const char *name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is case-insensitive. Returns 0 if no codec matching the name name could be found.
Upstream PySide2 reference signatures (binding differences may apply):
codecForName(name: PySide2.QtCore.QByteArray) -> PySide2.QtCore.QTextCodec
codecForName(name: str) -> PySide2.QtCore.QTextCodec
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#codecForName
codecForUtfText
codecForUtfText(ba: Any, defaultCodec: Any) -> Any
X.codecForUtfText(ba, defaultCodec) -> PythonQt.QtCore.QTextCodec
Supplemental documentation: Qt 5 reference:
[static] QTextCodec *QTextCodec::codecForUtfText(const QByteArray \&ba, QTextCodec *defaultCodec)
Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance that is capable of decoding the text to unicode. This function can detect one of the following codecs:
- UTF-32 Little Endian
- UTF-32 Big Endian
- UTF-16 Little Endian
- UTF-16 Big Endian
- UTF-8
If the codec cannot be detected from the content provided, defaultCodec is returned.
This function was introduced in Qt 4.6.
See also codecForHtml().
[static] QTextCodec *QTextCodec::codecForUtfText(const QByteArray \&ba)
This is an overloaded function.
Tries to detect the encoding of the provided snippet ba by using the BOM (Byte Order Mark) and returns a QTextCodec instance that is capable of decoding the text to unicode. This function can detect one of the following codecs:
- UTF-32 Little Endian
- UTF-32 Big Endian
- UTF-16 Little Endian
- UTF-16 Big Endian
- UTF-8
If the codec cannot be detected from the content provided, this overload returns a Latin-1 QTextCodec.
See also codecForHtml().
Upstream PySide2 reference signatures (binding differences may apply):
codecForUtfText(ba: PySide2.QtCore.QByteArray) -> PySide2.QtCore.QTextCodec
codecForUtfText(ba: PySide2.QtCore.QByteArray, defaultCodec: PySide2.QtCore.QTextCodec) -> PySide2.QtCore.QTextCodec
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#codecForUtfText
convertFromUnicode
convertFromUnicode(*args: Any, **kwargs: Any) -> Any
X.convertFromUnicode(in, length, state) -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
[pure virtual protected] QByteArray QTextCodec::convertFromUnicode(const QChar *input, int number, QTextCodec::ConverterState *state) const
QTextCodec subclasses must reimplement this function.
Converts the first number of characters from the input array from Unicode to the encoding of the subclass, and returns the result in a QByteArray.
state can be nullptr in which case the conversion is stateless and default
conversion rules should be used. If state is not 0, the codec should save the state
after the conversion in state, and adjust the remainingChars and invalidChars
members of the struct.
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#convertFromUnicode
convertToUnicode
convertToUnicode(*args: Any, **kwargs: Any) -> str
X.convertToUnicode(in, length, state) -> str
Supplemental documentation: Qt 5 reference:
[pure virtual protected] QString QTextCodec::convertToUnicode(const char *chars, int len, QTextCodec::ConverterState *state) const
QTextCodec subclasses must reimplement this function.
Converts the first len characters of chars from the encoding of the subclass to Unicode, and returns the result in a QString.
state can be nullptr, in which case the conversion is stateless and default
conversion rules should be used. If state is not 0, the codec should save the state
after the conversion in state, and adjust the remainingChars and invalidChars
members of the struct.
Upstream PySide2 reference signatures (binding differences may apply):
convertToUnicode(self, in_: str, length: int, state: PySide2.QtCore.QTextCodec.ConverterState) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#convertToUnicode
fromUnicode
fromUnicode(uc: str) -> Any
X.fromUnicode(uc) -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
QByteArray QTextCodec::fromUnicode(const QString \&str) const
Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray.
QByteArray QTextCodec::fromUnicode(QStringView str) const
This is an overloaded function.
Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray.
This function was introduced in Qt 5.10.
QByteArray QTextCodec::fromUnicode(const QChar *input, int number, QTextCodec::ConverterState *state \= nullptr) const
Converts the first number of characters from the input array from Unicode to the encoding of this codec, and returns the result in a QByteArray.
The state of the convertor used is updated.
Upstream PySide2 reference signatures (binding differences may apply):
fromUnicode(self, uc: str) -> PySide2.QtCore.QByteArray
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#fromUnicode
makeDecoder
makeDecoder(arg0: flags) -> Any
X.makeDecoder(flags) -> PythonQt.QtCore.QTextDecoder
Supplemental documentation: Qt 5 reference:
QTextDecoder *QTextCodec::makeDecoder(QTextCodec::ConversionFlags flags \= DefaultConversion) const
Creates a QTextDecoder with a
specified flags to decode chunks of char * data to create chunks of Unicode data.
The caller is responsible for deleting the returned object.
This function was introduced in Qt 4.7.
Upstream PySide2 reference signatures (binding differences may apply):
makeDecoder(self, flags: PySide2.QtCore.QTextCodec.ConversionFlags=...) -> PySide2.QtCore.QTextDecoder
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#makeDecoder
makeEncoder
makeEncoder(arg0: flags) -> Any
X.makeEncoder(flags) -> PythonQt.QtCore.QTextEncoder
Supplemental documentation: Qt 5 reference:
QTextEncoder *QTextCodec::makeEncoder(QTextCodec::ConversionFlags flags \= DefaultConversion) const
Creates a QTextEncoder with a
specified flags to encode chunks of Unicode data as char * data.
The caller is responsible for deleting the returned object.
This function was introduced in Qt 4.7.
Upstream PySide2 reference signatures (binding differences may apply):
makeEncoder(self, flags: PySide2.QtCore.QTextCodec.ConversionFlags=...) -> PySide2.QtCore.QTextEncoder
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#makeEncoder
mibEnum
mibEnum() -> int
X.mibEnum() -> int
Supplemental documentation: Qt 5 reference:
[pure virtual] int QTextCodec::mibEnum() const
Subclasses of QTextCodec must reimplement this function. It returns the MIBenum (see IANA character-sets encoding file for more information). It is important that each QTextCodec subclass returns the correct unique value for this function.
Upstream PySide2 reference signatures (binding differences may apply):
mibEnum(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#mibEnum
name
name() -> Any
X.name() -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
[pure virtual] QByteArray QTextCodec::name() const
QTextCodec subclasses must reimplement this function. It returns the name of the encoding supported by the subclass.
If the codec is registered as a character set in the IANA character-sets encoding file this method should return the preferred mime name for the codec if defined, otherwise its name.
Upstream PySide2 reference signatures (binding differences may apply):
name(self) -> PySide2.QtCore.QByteArray
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#name
setCodecForLocale
setCodecForLocale(c: Any) -> None
X.setCodecForLocale(c)
Supplemental documentation: Qt 5 reference:
[static] void QTextCodec::setCodecForLocale(QTextCodec *c)
Set the codec to c; this will be returned by
codecForLocale().
If c is nullptr, the codec is reset to the default.
This might be needed for some applications that want to use their own mechanism for setting the locale.
Warning: This function is not reentrant.
See also codecForLocale().
Upstream PySide2 reference signatures (binding differences may apply):
setCodecForLocale(c: PySide2.QtCore.QTextCodec) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#setCodecForLocale
toUnicode
toUnicode(arg__1: Any) -> str
X.toUnicode(arg__1) -> str
Supplemental documentation: Qt 5 reference:
QString QTextCodec::toUnicode(const QByteArray \&a) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString.
QString QTextCodec::toUnicode(const char *chars) const
This is an overloaded function.
chars contains the source characters.
QString QTextCodec::toUnicode(const char *input, int size, QTextCodec::ConverterState *state \= nullptr) const
Converts the first size characters from the input from the encoding of this codec to Unicode, and returns the result in a QString.
The state of the convertor used is updated.
Upstream PySide2 reference signatures (binding differences may apply):
toUnicode(self, arg__1: PySide2.QtCore.QByteArray) -> str
toUnicode(self, chars: str) -> str
toUnicode(self, in_: str, length: int, state: typing.Optional[PySide2.QtCore.QTextCodec.ConverterState]=...) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtextcodec.html#toUnicode