FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/cefpython/var/WideCharToPyString.pyx at cefpython31 · cztomczak/cefpython · GitHub
cztomczak
/
cefpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
477
Star
3.2k
Code
Issues
223
Pull requests
4
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
cefpython
/
var
/
WideCharToPyString.pyx
Copy path
More file actions
More file actions
Latest commit
History
History
History
12 lines (11 loc) · 515 Bytes
Breadcrumbs
cefpython
/
cefpython
/
var
/
WideCharToPyString.pyx
Copy path
File metadata and controls
12 lines (11 loc) · 515 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
from
stddef cimport wchar_t
cdef
object
WideCharToPyString(wchar_t
*
wcharstr):
cdef
int
charstr_bytes
=
WideCharToMultiByte(CP_UTF8,
0
, wcharstr,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
cdef
char
*
charstr
=
<
char
*
>
calloc(charstr_bytes, sizeof(
char
))
cdef
int
copied_bytes
=
WideCharToMultiByte(CP_UTF8,
0
, wcharstr,
-
1
, charstr, charstr_bytes,
NULL
,
NULL
)
if
bytes
==
str
:
pystring
=
"
"
+
charstr
#
Python 2.7
else
:
pystring
=
(b
"
"
+
charstr).decode(
"
utf-8
"
,
"
ignore
"
)
#
Python 3
free(charstr)
return
pystring
Back
|
FazBrowse Home
|
New Git URL