
Go to the source code of this file.
Defines | |
| #define | VLC_CHARSET_H 1 |
Functions | |
| void | LocaleFree (const char *) |
| Releases (if needed) a localized or uniformized string. | |
| char * | FromLocale (const char *) |
| Converts a string from the system locale character encoding to UTF-8. | |
| char * | FromLocaleDup (const char *) |
| converts a string from the system locale character encoding to utf-8, the result is always allocated on the heap. | |
| char * | ToLocale (const char *) |
| ToLocale: converts an UTF-8 string to local system encoding. | |
| char * | ToLocaleDup (const char *) |
| converts a string from UTF-8 to the system locale character encoding, the result is always allocated on the heap. | |
| int | utf8_open (const char *filename, int flags,...) |
| Opens a system file handle. | |
| FILE * | utf8_fopen (const char *filename, const char *mode) |
| Opens a FILE pointer. | |
| DIR * | utf8_opendir (const char *dirname) |
| Opens a DIR pointer. | |
| char * | utf8_readdir (DIR *dir) |
| Reads the next file name from an open directory. | |
| int | utf8_loaddir (DIR *dir, char ***namelist, int(*select)(const char *), int(*compar)(const char **, const char **)) |
| Does the same as utf8_scandir(), but takes an open directory pointer instead of a directory path. | |
| int | utf8_scandir (const char *dirname, char ***namelist, int(*select)(const char *), int(*compar)(const char **, const char **)) |
| Selects file entries from a directory, as GNU C scandir(). | |
| int | utf8_mkdir (const char *filename, mode_t mode) |
| Creates a directory using UTF-8 paths. | |
| int | utf8_unlink (const char *filename) |
| Removes a file. | |
| int | utf8_rename (const char *, const char *) |
| Moves a file atomically. | |
| int | utf8_stat (const char *filename, struct stat *buf) |
| Finds file/inode informations, as stat(). | |
| int | utf8_lstat (const char *filename, struct stat *buf) |
| Finds file/inode informations, as lstat(). | |
| 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. | |
| int | utf8_mkstemp (char *) |
| char * | EnsureUTF8 (char *) |
| Replaces invalid/overlong UTF-8 sequences with question marks. | |
| const char * | IsUTF8 (const char *) |
| 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. | |
| const char * | GetFallbackEncoding (void) |
| GetFallbackEncoding() suggests an encoding to be used for non UTF-8 text files accord to the system's local settings. | |
| 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. | |
| 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. | |
| 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. | |
| int | us_asprintf (char **, const char *,...) |
| us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale. | |
| #define VLC_CHARSET_H 1 |
| 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 CheckUTF8().
Referenced by AddItem(), CdTextParse(), decode_URI(), Demux(), Filter(), FixUTF8(), HandleMeta(), InputMetaUser(), KeyToUTF8(), LoadChapterApple(), LoadChapterGpac(), MakeAttribute(), MemoryReadString1(), mvnprintw(), ParseAPEvXTag(), ParsePicture(), ParseSDP(), ParseText(), ReadICYMeta(), Request(), StoreString(), StreamReadString2(), Subtitle(), test(), and vorbis_ParseComment().
| static char* FromLatin1 | ( | const char * | latin | ) | [inline, static] |
Converts a nul-terminated string from ISO-8859-1 to UTF-8.
References c, gen_builder::str, and utf8.
| char* FromLocale | ( | const char * | locale | ) |
Converts a string from the system locale character encoding to UTF-8.
| locale | nul-terminated string to convert |
References locale_fast().
Referenced by config_GetAppDir(), GetDir(), and sFromLocale().
| 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 locale_dup().
Referenced by __config_LoadConfigFile(), config_GetHomeDir(), config_GetTypeDir(), Import_M3U(), KeyToUTF8(), and ReloadWaveoutDevices().
| const char* GetFallbackEncoding | ( | void | ) |
GetFallbackEncoding() suggests an encoding to be used for non UTF-8 text files accord to the system's local settings.
It is only a best guess.
References FindFallbackEncoding(), and getenv().
Referenced by OpenDecoder().
| 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 CheckUTF8().
Referenced by IsSDPString(), ParseText(), and test().
| 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(), Demux(), GetDir(), gnutls_ServerAddCA(), gnutls_ServerAddCRL(), mvnprintw(), Open(), OpenServer(), ReadMeta(), sFromLocale(), sToLocale(), utf8_mkdir(), utf8_open(), utf8_opendir(), utf8_rename(), utf8_statEx(), utf8_unlink(), vlc_getaddrinfo(), and WriteMeta().
| char* ToLocale | ( | const char * | utf8 | ) |
ToLocale: converts an UTF-8 string to local system encoding.
| utf8 | nul-terminated string to be converted |
References locale_fast().
Referenced by gnutls_ServerAddCA(), gnutls_ServerAddCRL(), mvnprintw(), Open(), OpenServer(), ReadMeta(), sToLocale(), utf8_mkdir(), utf8_open(), utf8_opendir(), utf8_rename(), utf8_statEx(), utf8_unlink(), vlc_getaddrinfo(), and WriteMeta().
| 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 locale_dup().
Referenced by Open(), utf8_vasprintf(), and vcd_Open().
| int us_asprintf | ( | char ** | , | |
| const char * | , | |||
| ... | ||||
| ) |
us_asprintf() has the same prototype as asprintf(), but doesn't use the system locale.
References freelocale(), LC_NUMERIC_MASK, newlocale(), uselocale(), and vasprintf().
Referenced by UpdateVolume().
| 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_Command(), main(), Open(), OpenDemux(), var_OptionParse(), and vout_IntfInit().
| 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 main(), ParseMicroDvd(), ParseMPSub(), RtspCallback(), and 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().
Referenced by BandsCallback(), and ParseMRL().
| FILE* utf8_fopen | ( | const char * | filename, | |
| const char * | mode | |||
| ) |
Opens a FILE pointer.
| filename | file path, using UTF-8 encoding | |
| mode | fopen file open mode |
References utf8_open().
Referenced by ACL_LoadFile(), ArtCallback(), config_OpenConfigFile(), GetSCIData(), HttpCallback(), ImageWriteUrl(), libvlc_InternalInit(), Open(), OpenVCDImage(), osd_parser_simpleOpen(), ParseDirectory(), playlist_Export(), playlist_SaveArt(), ReadPasswordFile(), ReadUserKey(), Start(), svg_GetTemplate(), Trigger(), UnpackFromFile(), vout_snapshot_SaveImage(), and WriteUserKey().
| int utf8_fprintf | ( | FILE * | , | |
| const char * | , | |||
| ... | ||||
| ) |
Formats an UTF-8 string as fprintf(), then print it, with appropriate conversion to local encoding.
References utf8_vfprintf().
Referenced by Export_M3U(), Help(), libvlc_InternalInit(), ListModules(), print_help_on_full_help(), print_help_section(), PrintMsg(), Usage(), and Version().
| int utf8_loaddir | ( | DIR * | dir, | |
| char *** | namelist, | |||
| int(*)(const char *) | select, | |||
| int(*)(const char **, const char **) | compar | |||
| ) |
Does the same as utf8_scandir(), but takes an open directory pointer instead of a directory path.
References dummy_select(), i, rewinddir, and utf8_readdir().
Referenced by utf8_scandir().
| int utf8_lstat | ( | const char * | filename, | |
| struct stat * | buf | |||
| ) |
Finds file/inode informations, as lstat().
Consider using fstat() instead, if possible.
| filename | UTF-8 file path |
References utf8_statEx().
Referenced by gnutls_Addx509Directory().
| int utf8_mkdir | ( | const char * | dirname, | |
| mode_t | mode | |||
| ) |
Creates a directory using UTF-8 paths.
| dirname | a UTF-8 string with the name of the directory that you want to create. | |
| mode | directory permissions |
References LocaleFree(), and ToLocale().
Referenced by ArtCacheCreateDir(), config_CreateDir(), GetTmpPath(), gnutls_Addx509Directory(), and OpenClient().
| int utf8_mkstemp | ( | char * | ) |
References i, utf8_open(), and vlc_rand_bytes().
| int utf8_open | ( | const char * | filename, | |
| int | flags, | |||
| ... | ||||
| ) |
Opens a system file handle.
| filename | file path to open (with UTF-8 encoding) | |
| flags | open() flags, see the C library open() documentation |
References LocaleFree(), and ToLocale().
Referenced by CAMOpen(), Create(), DMXSetFilter(), DVROpen(), Filter(), FrontendOpen(), gnutls_Addx509File(), ioctl_Open(), Open(), open_file(), OpenAudioDev(), OpenAudioDevOss(), OpenDecoderCommon(), OpenDisplay(), OpenVCDImage(), OpenVideoDev(), ProbeAudioDevOss(), ProbeDVD(), ProbeVideoDev(), SaveConfigFile(), utf8_fopen(), utf8_mkstemp(), and vlc_rand_init().
| DIR* utf8_opendir | ( | const char * | dirname | ) |
Opens a DIR pointer.
| dirname | UTF-8 representation of the directory name |
References LocaleFree(), opendir, and ToLocale().
Referenced by Block(), gnutls_Addx509Directory(), input_CreateFilename(), Open(), ParseDirectory(), playlist_FindArtInCache(), ReadDir(), utf8_scandir(), vlclua_opendir(), and vout_snapshot_SaveImage().
| char* utf8_readdir | ( | DIR * | dir | ) |
Reads the next file name from an open directory.
| dir | The directory that is being read |
References dirent::d_name, readdir, and vlc_fix_readdir().
Referenced by Block(), gnutls_Addx509Directory(), ParseDirectory(), playlist_FindArtInCache(), ReadDir(), utf8_loaddir(), and vlclua_opendir().
| int utf8_rename | ( | const char * | oldpath, | |
| const char * | newpath | |||
| ) |
Moves a file atomically.
This only works within a single file system.
| oldpath | path to the file before the move | |
| newpath | intended path to the file after the move |
References LocaleFree(), and ToLocale().
Referenced by SaveConfigFile().
| int utf8_scandir | ( | const char * | dirname, | |
| char *** | namelist, | |||
| int(*)(const char *) | select, | |||
| int(*)(const char **, const char **) | compar | |||
| ) |
Selects file entries from a directory, as GNU C scandir().
| dirname | UTF-8 diretory path | |
| pointer | [OUT] pointer set, on succesful completion, to the address of a table of UTF-8 filenames. All filenames must be freed with free(). The table itself must be freed with free() as well. |
References closedir, utf8_loaddir(), and utf8_opendir().
Referenced by Load(), mvar_FileSetNew(), subtitles_Detect(), and vlclua_scripts_batch_execute().
| int utf8_stat | ( | const char * | filename, | |
| struct stat * | buf | |||
| ) |
Finds file/inode informations, as stat().
Consider using fstat() instead, if possible.
| filename | UTF-8 file path |
References utf8_statEx().
Referenced by CheckFileList(), FindMeta(), FindPathBase(), GetTmpPath(), InputGetExtraFilesPattern(), ioctl_Open(), ThemeLoader::load(), mvar_FileSetNew(), ParseDirectory(), playlist_MLLoad(), playlist_SaveArt(), ReadDir(), Run(), SubtitleAdd(), subtitles_Detect(), vlclua_stat(), and vout_snapshot_SaveImage().
| int utf8_unlink | ( | const char * | filename | ) |
Removes a file.
| filename | a UTF-8 string with the name of the file you want to delete. |
References LocaleFree(), and ToLocale().
Referenced by Close(), OutputStart(), and SaveConfigFile().
| 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 gen_builder::str, and utf8_vasprintf().
Referenced by __msg_rc(), and utf8_fprintf().
1.5.6