M
Mark Summerfield
Hi,
I am using ctypes to access a function in a DLL using Python 3.3 32-bit on Windows 7 64-bit:
dplGetPageText = dpl.DPLGetPageText
dplGetPageText.argtypes = (ctypes.c_int, ctypes.c_int)
dplGetPageText.restype = ctypes.c_wchar_p
Python returns this as a str with the raw bytes already decoded.
Unfortunately, when the returned text contains some special characters (e.g.. © or ï¬) it is not encoded correctly. This may be a problem with Windows or with ctypes or with the library I'm using; or of course, it could be my own mistake.
To find out, I'd like to change the restype to give me the raw bytes so that I can view them and if necessary decode them myself.
Can anyone tell me how to change the restype to get the bytes?
Thanks!
I am using ctypes to access a function in a DLL using Python 3.3 32-bit on Windows 7 64-bit:
dplGetPageText = dpl.DPLGetPageText
dplGetPageText.argtypes = (ctypes.c_int, ctypes.c_int)
dplGetPageText.restype = ctypes.c_wchar_p
Python returns this as a str with the raw bytes already decoded.
Unfortunately, when the returned text contains some special characters (e.g.. © or ï¬) it is not encoded correctly. This may be a problem with Windows or with ctypes or with the library I'm using; or of course, it could be my own mistake.
To find out, I'd like to change the restype to give me the raw bytes so that I can view them and if necessary decode them myself.
Can anyone tell me how to change the restype to get the bytes?
Thanks!