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

Map files containing Unicode can fail in mappyfile.load with python2.7 #74

Closed
ianturton opened this issue Mar 13, 2019 · 4 comments
Closed

Comments

@ianturton
Copy link
Contributor

@ianturton ianturton commented Mar 13, 2019

If your map file has unicode in it and the user hasn't used encoding="utf-8" in the file open the parser will fail when it tries to parse the mapfile.

ianturton added a commit to ianturton/mappyfile that referenced this issue Mar 13, 2019
@geographika
Copy link
Owner

@geographika geographika commented Mar 20, 2019

@ianturton I've tried to recreate the error, but currently unable to on Python 2.7
The text is already converted to Unicode in py2 with the lines at the top of the file:

PY2 = sys.version_info[0] < 3
if PY2:
    str = unicode # NOQA

And then uses this later:

text = str(text)

I can load the sample CLASS in your pull request without issues. Could you paste an error stack trace?

Loading

@ianturton
Copy link
Contributor Author

@ianturton ianturton commented Mar 20, 2019

Loading

geographika added a commit that referenced this issue Mar 20, 2019
@geographika
Copy link
Owner

@geographika geographika commented Mar 20, 2019

@ianturton - recreated. Didn't realise I was testing on py3 at the time. I've updated the parser with the code from your pull request but with a few other changes, and pushed to master. Could you confirm this works for you when you get a chance?

Loading

@geographika
Copy link
Owner

@geographika geographika commented Mar 29, 2019

Deployed in 0.8.2 release

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants