VLC
3.0.15
|
Go to the source code of this file.
Functions | |
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. More... | |
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. More... | |
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. More... | |
int | us_vasprintf (char **, const char *, va_list) |
us_vasprintf() has the same prototype as vasprintf(), but doesn't use the system locale. More... | |
int | us_asprintf (char **, const char *,...) |
us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale. More... | |
#define | VLC_ICONV_ERR ((size_t) -1) |
#define | FromLocale(l) (l) |
#define | ToLocale(u) (u) |
#define | LocaleFree(s) ((void)(s)) |
#define | FromLocaleDup strdup |
#define | ToLocaleDup strdup |
typedef void * | vlc_iconv_t |
size_t | vlc_towc (const char *str, uint32_t *restrict pwc) |
Decodes a code point from UTF-8. More... | |
static const char * | IsUTF8 (const char *str) |
Checks UTF-8 validity. More... | |
static char * | EnsureUTF8 (char *str) |
Removes non-UTF-8 sequences. More... | |
vlc_iconv_t | vlc_iconv_open (const char *, const char *) |
size_t | vlc_iconv (vlc_iconv_t, const char **, size_t *, char **, size_t *) |
int | vlc_iconv_close (vlc_iconv_t) |
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. More... | |
int | utf8_fprintf (FILE *, const char *,...) |
Formats an UTF-8 string as fprintf(), then print it, with appropriate conversion to local encoding. More... | |
char * | vlc_strcasestr (const char *, const char *) |
Look for an UTF-8 string within another one in a case-insensitive fashion. More... | |
char * | FromCharset (const char *charset, const void *data, size_t data_size) |
Converts a string from the given character encoding to utf-8. More... | |
void * | ToCharset (const char *charset, const char *in, size_t *outsize) |
Converts a nul-terminated UTF-8 string to a given character encoding. More... | |
static char * | FromLatin1 (const char *latin) |
Converts a nul-terminated string from ISO-8859-1 to UTF-8. More... | |
Characters sets handling
#define FromLocale | ( | l | ) | (l) |
#define FromLocaleDup strdup |
#define LocaleFree | ( | s | ) | ((void)(s)) |
#define ToLocale | ( | u | ) | (u) |
#define ToLocaleDup strdup |
#define VLC_ICONV_ERR ((size_t) -1) |
typedef void* vlc_iconv_t |
|
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 AppendAttachment(), filename_sanitize(), and input_item_SetURI().
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_readdir().
|
inlinestatic |
Converts a nul-terminated string from ISO-8859-1 to UTF-8.
|
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, and vlc_towc().
Referenced by IsSDPString(), and vlc_meta_Set().
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().
int us_asprintf | ( | char ** | , |
const char * | , | ||
... | |||
) |
us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale.
References us_vasprintf().
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(), var_OptionParse(), and vlc_audio_replay_gain_MergeFromMeta().
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().
Referenced by us_atof().
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().
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 us_asprintf().
int utf8_fprintf | ( | FILE * | , |
const char * | , | ||
... | |||
) |
Formats an UTF-8 string as fprintf(), then print it, with appropriate conversion to local encoding.
References vlc_memstream::stream, and 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, vlc_memstream::stream, unlikely, and vasprintf().
Referenced by utf8_fprintf().
size_t vlc_iconv | ( | vlc_iconv_t | , |
const char ** | , | ||
size_t * | , | ||
char ** | , | ||
size_t * | |||
) |
Referenced by FromCharset(), ToCharset(), and vlc_stream_ReadLine().
int vlc_iconv_close | ( | vlc_iconv_t | ) |
Referenced by FromCharset(), stream_CommonDelete(), ToCharset(), and vlc_stream_ReadLine().
vlc_iconv_t vlc_iconv_open | ( | const char * | , |
const char * | |||
) |
Referenced by FromCharset(), ToCharset(), and vlc_stream_ReadLine().
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().
size_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] |
(size_t)-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 |
Referenced by EnsureUTF8(), IsUTF8(), vlc_str2keycode(), and vlc_strcasestr().