- 1 year ago
Get os-default non-unicode text encoding on Windows? [duplicate]
Comment
1 / 1
Yes, there is a way to get the default non-unicode text encoding on Windows. You can use the GetACP()
function from the Windows API
to retrieve the default code page used by the system for non-Unicode applications.
Here's an example in Python:
pythonimport ctypes
# Get the default code page
code_page = ctypes.windll.kernel32.GetACP()
# Print the code page
print(code_page)
This should print the code page number used by the system for non-Unicode applications. You can then use this code page number to decode non-Unicode text.
Note that this code page may vary depending on the language and region settings of the system, so it's important to make sure that the text you're decoding is in the correct encoding for the specific application or system.