|
VLC 4.0.0-dev
|
Topics | |
| iconv wrappers | |
| (defined in src/extras/libc.c) | |
| C/POSIX locale functions | |
Files | |
| file | vlc_charset.h |
Macros | |
| #define | FromLocale(l) |
| #define | ToLocale(u) |
| #define | LocaleFree(s) |
| #define | FromLocaleDup strdup |
| #define | ToLocaleDup strdup |
Functions | |
| ssize_t | vlc_towc (const char *str, uint32_t *restrict pwc) |
| Decodes a code point from UTF-8. | |
| static const char * | IsUTF8 (const char *str) |
| Checks UTF-8 validity. | |
| static const char * | IsASCII (const char *str) |
| Checks ASCII validity. | |
| static char * | EnsureUTF8 (char *str) |
| Removes non-UTF-8 sequences. | |
| int | utf8_vfprintf (FILE *stream, const char *fmt, va_list ap) |
| Formats an UTF-8 string as vfprintf(), then print it, with appropriate conversion to local encoding. | |
| int | utf8_fprintf (FILE *, const char *,...) |
| Formats an UTF-8 string as fprintf(), then print it, with appropriate conversion to local encoding. | |
| char * | vlc_strcasestr (const char *, const char *) |
| Look for an UTF-8 string within another one in a case-insensitive fashion. | |
| char * | FromCharset (const char *charset, const void *data, size_t data_size) |
| Converts a string from the given character encoding to utf-8. | |
| void * | ToCharset (const char *charset, const char *in, size_t *outsize) |
| Converts a nul-terminated UTF-8 string to a given character encoding. | |
| static char * | FromLatin1 (const char *latin) |
| Converts a nul-terminated string from ISO-8859-1 to UTF-8. | |
| #define FromLocale | ( | l | ) |
| #define FromLocaleDup strdup |
Referenced by config_GetDataDir(), config_GetHomeDir(), config_GetLibDir(), config_GetLibExecDir(), config_GetRealDir(), and vlc_dlerror().
| #define LocaleFree | ( | s | ) |
Referenced by vlc_bindtextdomain().
| #define ToLocale | ( | u | ) |
Referenced by vlc_bindtextdomain().
| #define ToLocaleDup strdup |
Referenced by vlc_dlopen(), vlc_getcwd(), vlc_mkdir(), vlc_open(), vlc_opendir(), vlc_rename(), vlc_statEx(), and vlc_unlink().
|
inlinestatic |
Removes non-UTF-8 sequences.
Replaces invalid or over-long UTF-8 bytes sequences within a null-terminated string with question marks. This is so that the string can be printed at least partially.
| str | the string is a valid null-terminated UTF-8 sequence (i.e. no changes were made) |
| NULL | the string is not an UTF-8 sequence |
References likely, and vlc_towc().
Referenced by filename_sanitize(), input_item_SetURI(), and InputMetaUser().
| char * FromCharset | ( | const char * | charset, |
| const void * | data, | ||
| size_t | data_size ) |
Converts a string from the given character encoding to utf-8.
References vlc_iconv(), vlc_iconv_close(), and vlc_iconv_open().
Referenced by vlc_iconv_close(), and vlc_readdir().
|
inlinestatic |
Converts a nul-terminated string from ISO-8859-1 to UTF-8.
|
inlinestatic |
Checks ASCII validity.
Checks whether a null-terminated string is a valid ASCII bytes sequence (non-printable ASCII characters 1-31 are permitted).
| str | string to check |
| str | the string is a valid null-terminated ASCII sequence |
| NULL | the string is not an ASCII sequence |
|
inlinestatic |
Checks UTF-8 validity.
Checks whether a null-terminated string is a valid UTF-8 bytes sequence.
| str | string to check |
| str | the string is a valid null-terminated UTF-8 sequence |
| NULL | the string is not an UTF-8 sequence |
References likely, vlc_towc(), and VLC_USED.
Referenced by vlc_meta_SetWithPriority().
| void * ToCharset | ( | const char * | charset, |
| const char * | in, | ||
| size_t * | outsize ) |
Converts a nul-terminated UTF-8 string to a given character encoding.
| charset | iconv name of the character set |
| in | nul-terminated UTF-8 string |
| outsize | pointer to hold the byte size of result |
References unlikely, vlc_iconv(), vlc_iconv_close(), and vlc_iconv_open().
Referenced by vlc_iconv_close().
| int utf8_fprintf | ( | FILE * | stream, |
| const char * | fmt, | ||
| ... ) |
Formats an UTF-8 string as fprintf(), then print it, with appropriate conversion to local encoding.
References utf8_vfprintf().
| int utf8_vfprintf | ( | FILE * | stream, |
| const char * | fmt, | ||
| va_list | ap ) |
Formats an UTF-8 string as vfprintf(), then print it, with appropriate conversion to local encoding.
References likely, unlikely, and vasprintf().
Referenced by utf8_fprintf().
| char * vlc_strcasestr | ( | const char * | haystack, |
| const char * | needle ) |
Look for an UTF-8 string within another one in a case-insensitive fashion.
Beware that this is quite slow. Contrary to strcasestr(), this function works regardless of the system character encoding, and handles multibyte code points correctly.
| haystack | string to look into |
| needle | string to look for |
References unlikely, and vlc_towc().
Referenced by vlc_iconv_close().
| ssize_t vlc_towc | ( | const char * | str, |
| uint32_t *restrict | pwc ) |
Decodes a code point from UTF-8.
Converts the first character in a UTF-8 sequence into a Unicode code point.
| str | an UTF-8 bytes sequence [IN] |
| pwc | address of a location to store the code point [OUT] |
| -1 | not a valid UTF-8 sequence |
| 0 | null character (i.e. str points to an empty string) |
| 1 | (non-null) ASCII character |
| 2-4 | non-ASCII character |
References likely, and unlikely.
Referenced by EnsureUTF8(), IsUTF8(), print_desc(), vlc_str2keycode(), vlc_strcasestr(), vlc_swidth(), and vlc_xml_encode().