-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
imread supports Non-ASCII filename in opencv-python+Windows #18305
Copy link
Copy link
Open
Milestone
Description
System information (version)
- OpenCV => 4.4
- Operating System / Platform => Windows
- Compiler => opencv-python
Detailed description
#13368 (comment)
Although in this issue the opencv team decided not to change the c++ api
But the processing method in opencv-python may be better
imread was called with the wrong encoding here
should: ANSI
real: UTF8
opencv/modules/python/src2/pycompat.hpp
Line 68 in 318cba4
| PyObject * bytes = PyUnicode_AsUTF8String(obj); |
https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_AsMBCSString
If PyUnicode_AsUTF8String here is replaced with PyUnicode_AsMBCSString under windows, it will be able to solve the encoding problem of reading and writing files such as opencv-python imread without other influence
Note: The getUnicodeString method may not only be used for file reading and writing, so we can add a new method and use PyUnicode_AsMBCSString
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable