class
UTF8
Provides methods to converting between UTF-8 character encoding and other popular encodings.
Public
Methods
staticFromAnsi
Converts from an ANSI encoding in the specified locale into UTF-8.
- input
- Narrow string encoded as ANSI characters. Characters are expected to be in the code page specified by .
- locale
- Locale that determines how are the ANSI characters interpreted.
Returns: UTF-8 encoded string.
staticToAnsi
Converts from an UTF-8 encoding into ANSI encoding in the specified locale.
- input
- Narrow string encoded as UTF-8 characters.
- locale
- Locale that determines from which code page to generate the ANSI characters.
- invalidChar
- Character that will be used when an Unicode character cannot be represented using the selected ANSI code page.
Returns: ANSI encoded string in the specified locale.
staticFromWide
Converts from a system-specific wide character encoding into UTF-8.
- input
- Wide string to convert. Actual encoding is system specific be can be assumed to be UTF-16 on Windows and UTF-32 on Unix.
Returns: UTF-8 encoded string.
staticToWide
Converts from an UTF-8 encoding into system-specific wide character encoding.
- input
- Narrow string encoded as UTF-8 characters.
Returns: Wide string encoded in a system-specific manner. Actual encoding can be assumed to be UTF-16 on Windows and UTF-32 and Unix.
staticFromUtF16
Converts from an UTF-16 encoding into UTF-8.
- input
- String encoded as UTF-16.
Returns: UTF-8 encoded string.
staticToUtF16
Converts from an UTF-8 encoding into UTF-16.
- input
- String encoded as UTF-8.
Returns: UTF-16 encoded string.
staticFromUtF32
Converts from an UTF-32 encoding into UTF-8.
- input
- String encoded as UTF-32.
Returns: UTF-8 encoded string.
staticToUtF32
Converts from an UTF-8 encoding into UTF-32.
- input
- String encoded as UTF-8.
Returns: UTF-32 encoded string.
staticCount
Counts the number of characters in the provided UTF-8 input string.
staticToLower
Converts the provided UTF8 encoded string to lowercase.
staticToUpper
Converts the provided UTF8 encoded string to uppercase.
staticCharToByteIndex
Returns the byte at which the character with the specified index starts.
The string is expected to be in UTF-8 encoding. If is out of range the method returns the index past the last byte in the string (same as the string length in bytes).
staticCharByteCount
Calculates the number of bytes taken up by the character at the specified position.