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

crash reading file with UTF-8 BOM + "# coding: utf-8" (supported since python 2.5) #189

Closed
lepistone opened this issue Aug 5, 2015 · 5 comments

Comments

@lepistone
Copy link
Contributor

Reading such a file fails at

https://github.com/mitsuhiko/babel/blob/master/babel/util.py#L81

however, those files seem to be supported since 2.5:

https://bugs.python.org/issue1378022

Would you consider a patch to allow such files in babel?

Thanks!

@sils
Copy link
Member

sils commented Aug 5, 2015

Sounds great, you plan to do a PR?

@lepistone
Copy link
Contributor Author

Sure. I gave a look at what cpython does now, and it looks like it compares the BOM and the comment, which sounds reasonable to me.

https://github.com/python/cpython/blob/master/Parser/tokenizer.c#L333-L339

@sils
Copy link
Member

sils commented Aug 5, 2015

Ah note that the code will also be tested against pypy so if they don't support that that will be a problem. We could make an interpreter branch though and only support that for CPython...

@lepistone
Copy link
Contributor Author

I tried, and pypy seems to have the same behavior (crashes only if there is a BOM but the comment says latin1).

@sils
Copy link
Member

sils commented Aug 5, 2015

Cool :)

2015-08-05 18:48 GMT+02:00 Leonardo Pistone [email protected]:

I tried, and pypy seems to have the same behavior (crashes only if there
is a BOM but the comment says latin1).


Reply to this email directly or view it on GitHub
#189 (comment).

gurneyalex added a commit to gurneyalex/odoo-eam that referenced this issue Aug 6, 2015
lepistone added a commit to lepistone/babel that referenced this issue Aug 7, 2015
lepistone added a commit to lepistone/babel that referenced this issue Aug 7, 2015
erickwilder added a commit that referenced this issue Sep 9, 2015
erickwilder pushed a commit to erickwilder/babel that referenced this issue Sep 23, 2015
gurneyalex added a commit to gurneyalex/odoo-eam that referenced this issue Sep 24, 2015
gurneyalex added a commit to gurneyalex/odoo-eam that referenced this issue Sep 24, 2015
gurneyalex added a commit to gurneyalex/odoo-eam that referenced this issue Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants