Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
e8afa139
Commit
e8afa139
authored
Feb 21, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few utf8 *printf wrappers (refs #556)
parent
ab65d88b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
src/misc/unicode.c
src/misc/unicode.c
+52
-0
No files found.
src/misc/unicode.c
View file @
e8afa139
...
...
@@ -30,6 +30,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
...
...
@@ -266,6 +267,19 @@ char *ToLocale( const char *utf8 )
#endif
}
char
*
ToLocaleDup
(
const
char
*
utf8
)
{
#if defined (ASSUME_UTF8)
return
strdup
(
utf8
);
#else
# ifdef USE_ICONV
if
(
to_locale
.
hd
==
(
vlc_iconv_t
)(
-
1
))
return
strdup
(
utf8
);
# endif
return
ToLocale
(
utf8
);
#endif
}
void
LocaleFree
(
const
char
*
str
)
{
#ifdef USE_ICONV
...
...
@@ -440,6 +454,44 @@ int utf8_lstat( const char *filename, void *buf)
return
utf8_statEx
(
filename
,
buf
,
VLC_FALSE
);
}
/*****************************************************************************
* utf8_*printf: *printf with conversion from UTF-8 to local encoding
*****************************************************************************/
int
utf8_vasprintf
(
char
**
str
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
utf8
;
int
res
=
vasprintf
(
&
utf8
,
fmt
,
ap
);
if
(
res
==
-
1
)
return
-
1
;
*
str
=
ToLocaleDup
(
utf8
);
free
(
utf8
);
return
res
;
}
int
utf8_vfprintf
(
FILE
*
stream
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
str
;
int
res
=
utf8_vasprintf
(
&
str
,
fmt
,
ap
);
if
(
res
==
-
1
)
return
-
1
;
fputs
(
str
,
stream
);
free
(
str
);
return
res
;
}
int
utf8_fprintf
(
FILE
*
stream
,
const
char
*
fmt
,
...
)
{
va_list
ap
;
int
res
;
va_start
(
ap
,
fmt
);
res
=
utf8_vfprintf
(
stream
,
fmt
,
ap
);
va_end
(
ap
);
return
res
;
}
/*****************************************************************************
* EnsureUTF8: replaces invalid/overlong UTF-8 sequences with question marks
*****************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment