-
Notifications
You must be signed in to change notification settings - Fork 277
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
UnicodeDecodeError in coerce_filename #27
Comments
What happens when you do open(.. that filename...), does it produce the On Tue, Jan 15, 2013 at 6:15 AM, Marian Steinbach
Adam Hupp | http://hupp.org/adam/ |
Have a chance to look at this? |
I can confirm this behaviour. Seems like coerce_filename has problems with UTF-8 encoded file names. Can be reproduced like this:
I'm running Python 2.7.5 with python_magic-0.4.6 |
I think the problem is that getfilesystemencoding() only returns UTF-8 if your LANG is set appropriately. Otherwise it's ascii or similar. I can repro the error that way in the unit test. Does this patch work for you? diff --git a/magic.py b/magic.py
is_unicode = (sys.version_info[0] <= 2 and
|
Oops, try this: https://gist.github.com/ahupp/daff4e7e2e4ebafbe14c |
Yes, the patch works. |
Fixed in 012f8a9 |
I have a file named:
When I try to read this with magic's from_file method, I get the following exception:
I am on MacOS X 10.8.2 with python 2.7.2.
The text was updated successfully, but these errors were encountered: