Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increment.decode('utf-8') issue #85

Open
mdlsunny opened this issue Aug 21, 2017 · 1 comment
Open

increment.decode('utf-8') issue #85

mdlsunny opened this issue Aug 21, 2017 · 1 comment

Comments

@mdlsunny
Copy link

Line 210 and 211 in sortphotos.py:
increment.decode('utf-8') encountered issue because it truncated bytes in size = 4096.
encoding 'utf-8' can have various bytes (1 to 4), thus increment = os.read(fd, 4096) may cut through a character. I found the issue while sorting through 80,000 photos, many of which had Chinese characters as names. In my case, because decode('utf-8') was done on increment, the issue occurred.

I think the decoding should be done on the full output: output += increment to be done first and then output.decode('utf-8') to be done afterward. I modify the source code and tested it. It worked.

Thank you for your effort to make such a great tool!

@andrewning
Copy link
Owner

Sorry for delay. That threw an error for me with Python 3. I'm not well versed in encoding/decoding to know what the best fix is here offhand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants