This files handles locale conversions in vlc. More...

Go to the source code of this file.
Typedefs | |
| typedef void * | vlc_iconv_t |
Functions | |
| VLC_API vlc_iconv_t | vlc_iconv_open (const char *, const char *) VLC_USED |
| VLC_API size_t | vlc_iconv (vlc_iconv_t, const char **, size_t *, char **, size_t *) VLC_USED |
| VLC_API int | vlc_iconv_close (vlc_iconv_t) |
| VLC_API void | LocaleFree (const char *) |
| Releases (if needed) a localized or uniformized string. | |
| VLC_API char * | FromLocale (const char *) VLC_USED |
| Converts a string from the system locale character encoding to UTF-8. | |
| VLC_API char * | FromLocaleDup (const char *) VLC_USED |
| converts a string from the system locale character encoding to utf-8, the result is always allocated on the heap. | |
| VLC_API char * | ToLocale (const char *) VLC_USED |
| ToLocale: converts an UTF-8 string to local system encoding. | |
| VLC_API char * | ToLocaleDup (const char *) VLC_USED |
| converts a string from UTF-8 to the system locale character encoding, the result is always allocated on the heap. | |
| VLC_API 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. | |
| VLC_API int | utf8_fprintf (FILE *, const char *,...) VLC_FORMAT(2 |
| VLC_API int VLC_API char * | vlc_strcasestr (const char *, const char *) VLC_USED |
| Look for an UTF-8 string within another one in a case-insensitive fashion. | |
| VLC_API char * | EnsureUTF8 (char *) |
| Replaces invalid/overlong UTF-8 sequences with question marks. | |
| VLC_API const char * | IsUTF8 (const char *) VLC_USED |
| Checks whether a string is a valid UTF-8 byte sequence. | |
| static char * | FromLatin1 (const char *latin) |
| Converts a nul-terminated string from ISO-8859-1 to UTF-8. | |
| VLC_API char * | FromCharset (const char *charset, const void *data, size_t data_size) VLC_USED |
| Converts a string from the given character encoding to utf-8. | |
| VLC_API void * | ToCharset (const char *charset, const char *in, size_t *outsize) VLC_USED |
| Converts a nul-terminated UTF-8 string to a given character encoding. | |
| VLC_API double | us_strtod (const char *, char **) VLC_USED |
| us_strtod() has the same prototype as ANSI C strtod() but it uses the POSIX/C decimal format, regardless of the current numeric locale. | |
| VLC_API float | us_strtof (const char *, char **) VLC_USED |
| us_strtof() has the same prototype as ANSI C strtof() but it uses the POSIX/C decimal format, regardless of the current numeric locale. | |
| VLC_API double | us_atof (const char *) VLC_USED |
| us_atof() has the same prototype as ANSI C atof() but it expects a dot as decimal separator, regardless of the system locale. | |
| VLC_API int | us_vasprintf (char **, const char *, va_list) |
| us_vasprintf() has the same prototype as vasprintf(), but doesn't use the system locale. | |
| VLC_API int | us_asprintf (char **, const char *,...) VLC_USED |
| us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale. | |
This files handles locale conversions in vlc.
| typedef void* vlc_iconv_t |
| VLC_API char* EnsureUTF8 | ( | char * | str | ) |
Replaces invalid/overlong UTF-8 sequences with question marks.
Note that it is not possible to convert from Latin-1 to UTF-8 on the fly, so we don't try that, even though it would be less disruptive.
References likely, and vlc_towc().
Referenced by filename_sanitize(), input_item_SetURI(), InputMetaUser(), and test().
| VLC_API 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 FromLocale(), FromLocaleDup(), and vlc_readdir().
| static char* FromLatin1 | ( | const char * | latin | ) | [inline, static] |
Converts a nul-terminated string from ISO-8859-1 to UTF-8.
| VLC_API char* FromLocale | ( | const char * | locale | ) |
Converts a string from the system locale character encoding to UTF-8.
| locale | nul-terminated string to convert |
References FromCharset().
Referenced by config_GetAppDir().
| VLC_API char* FromLocaleDup | ( | const char * | locale | ) |
converts a string from the system locale character encoding to utf-8, the result is always allocated on the heap.
| locale | nul-terminated string to convert |
References FromCharset(), and strdup().
Referenced by config_GetHomeDir(), config_GetLibDir(), config_GetTypeDir(), and vlc_readdir().
| VLC_API const char* IsUTF8 | ( | const char * | str | ) |
Checks whether a string is a valid UTF-8 byte sequence.
| str | nul-terminated string to be checked |
References likely, and vlc_towc().
Referenced by IsSDPString(), and test().
| VLC_API void LocaleFree | ( | const char * | str | ) |
Releases (if needed) a localized or uniformized string.
| str | non-NULL return value from FromLocale() or ToLocale(). |
Referenced by config_GetAppDir(), module_Load(), vlc_getaddrinfo(), vlc_mkdir(), vlc_open(), vlc_openat(), vlc_opendir(), vlc_rename(), vlc_statEx(), and vlc_unlink().
| VLC_API 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 ToLocale(), and ToLocaleDup().
| VLC_API char* ToLocale | ( | const char * | utf8 | ) |
ToLocale: converts an UTF-8 string to local system encoding.
| utf8 | nul-terminated string to be converted |
References ToCharset().
Referenced by module_Load(), vlc_getaddrinfo(), vlc_mkdir(), vlc_open(), vlc_openat(), vlc_opendir(), vlc_rename(), vlc_statEx(), and vlc_unlink().
| VLC_API char* ToLocaleDup | ( | const char * | utf8 | ) |
converts a string from UTF-8 to the system locale character encoding, the result is always allocated on the heap.
| utf8 | nul-terminated string to convert |
References strdup(), and ToCharset().
Referenced by utf8_vfprintf(), vlc_bindtextdomain(), and vlc_getcwd().
| VLC_API int us_asprintf | ( | char ** | , | |
| const char * | , | |||
| ... | ||||
| ) |
us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale.
References ap, us_vasprintf(), va_end(), and va_start().
| VLC_API double us_atof | ( | const char * | ) |
us_atof() has the same prototype as ANSI C atof() but it expects a dot as decimal separator, regardless of the system locale.
References us_strtod().
Referenced by config_ChainParse(), config_LoadCmdLine(), main(), var_Command(), var_InheritURational(), and var_OptionParse().
| VLC_API double us_strtod | ( | const char * | , | |
| char ** | ||||
| ) |
us_strtod() has the same prototype as ANSI C strtod() but it uses the POSIX/C decimal format, regardless of the current numeric locale.
References freelocale(), LC_NUMERIC_MASK, newlocale(), and uselocale().
| VLC_API float us_strtof | ( | const char * | , | |
| char ** | ||||
| ) |
us_strtof() has the same prototype as ANSI C strtof() but it uses the POSIX/C decimal format, regardless of the current numeric locale.
References freelocale(), LC_NUMERIC_MASK, newlocale(), strtof(), and uselocale().
| VLC_API int us_vasprintf | ( | char ** | , | |
| const char * | , | |||
| va_list | ||||
| ) |
us_vasprintf() has the same prototype as vasprintf(), but doesn't use the system locale.
References freelocale(), LC_NUMERIC_MASK, newlocale(), uselocale(), and vasprintf().
Referenced by httpd_MsgAdd(), and us_asprintf().
| VLC_API int utf8_fprintf | ( | FILE * | , | |
| const char * | , | |||
| ... | ||||
| ) |
| VLC_API 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, ToLocaleDup(), unlikely, and vasprintf().
Referenced by PrintColorMsg(), PrintMsg(), and utf8_fprintf().
| VLC_API size_t vlc_iconv | ( | vlc_iconv_t | , | |
| const char ** | , | |||
| size_t * | , | |||
| char ** | , | |||
| size_t * | ||||
| ) |
Referenced by FromCharset(), stream_ReadLine(), and ToCharset().
| VLC_API int vlc_iconv_close | ( | vlc_iconv_t | ) |
Referenced by FromCharset(), stream_CommonDelete(), stream_ReadLine(), and ToCharset().
| VLC_API vlc_iconv_t vlc_iconv_open | ( | const char * | , | |
| const char * | ||||
| ) |
Referenced by FromCharset(), stream_ReadLine(), and ToCharset().
| VLC_API int VLC_API 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 playlist_LiveSearchUpdateInternal(), and test_strcasestr().
1.7.1