FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/cefpython/var/WideCharToPyString.pyx at cefpython31 · swz-study/cefpython · GitHub
swz-study
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
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