Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
2b67ce72
Commit
2b67ce72
authored
Jul 22, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: use Unicode output for the console (fixes #3125)
parent
cc856b0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
src/text/unicode.c
src/text/unicode.c
+39
-2
No files found.
src/text/unicode.c
View file @
2b67ce72
...
...
@@ -223,8 +223,45 @@ static int utf8_vasprintf( char **str, const char *fmt, va_list ap )
int
utf8_vfprintf
(
FILE
*
stream
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
str
;
int
res
=
utf8_vasprintf
(
&
str
,
fmt
,
ap
);
if
(
res
==
-
1
)
int
res
;
#ifdef WIN32
/* Writing to the console is a lot of fun on Microsoft Windows.
* If you use the standard I/O functions, you must use the OEM code page,
* which is different from the usual ANSI code page. Or maybe not, if the
* user called "chcp". Anyway, we prefer Unicode. */
int
fd
=
_fileno
(
stream
);
if
(
likely
(
fd
!=
-
1
)
&&
_isatty
(
fd
))
{
res
=
vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
size_t
wlen
=
2
*
(
res
+
1
);
wchar_t
*
wide
=
malloc
(
wlen
);
if
(
likely
(
wide
!=
NULL
))
{
wlen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
str
,
res
+
1
,
wide
,
wlen
);
if
(
wlen
>
0
)
{
HANDLE
h
=
(
HANDLE
)(
intptr_t
)
_get_osfhandle
(
fd
);
DWORD
out
;
WriteConsoleW
(
h
,
wide
,
wlen
-
1
,
&
out
,
NULL
);
}
else
res
=
-
1
;
free
(
wide
);
}
else
res
=
-
1
;
free
(
str
);
return
res
;
}
#endif
res
=
utf8_vasprintf
(
&
str
,
fmt
,
ap
);
if
(
unlikely
(
res
==
-
1
))
return
-
1
;
fputs
(
str
,
stream
);
...
...
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