8000 Non-ASCII characters in project name causes error · Issue #9 · jtushman/pivotal_tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Non-ASCII characters in project name causes error #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and th 8000 e 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

Open
seniorio opened this issue Sep 25, 2013 · 3 comments
Open

Non-ASCII characters in project name causes error #9

seniorio opened this issue Sep 25, 2013 · 3 comments

Comments

@seniorio
Copy link

Hey, looks like I’m getting Python encoding errors if my Pivotal project name has a non-ASCII character in it, specifically ‘é’ in my case.

The error:

$ pivotal_tools changelog
Select a Project:
[1] An ASCII Project Name
[2] Another ASCII Project Name
Traceback (most recent call last):
  File "/usr/local/bin/pivotal_tools", line 9, in <module>
    load_entry_point('pivotal-tools==0.14', 'console_scripts', 'pivotal_tools')()
  File "/usr/local/lib/python2.7/dist-packages/pivotal_tools/cli.py", line 508, in main
    project = prompt_project(arguments)
  File "/usr/local/lib/python2.7/dist-packages/pivotal_tools/cli.py", line 353, in prompt_project
    print "[{}] {}".format(idx+1, project.name)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

The line in question:

print "[{}] {}".format(idx+1, project.name)

Adding the unicode u does fix the problem:

print u"[{}] {}".format(idx+1, project.name)

But I guess this will be a tool-wide issue. Happy to submit a PR if needed, depending on what you think the correct way to fix this is.

Cheers :)

@vielmath
Copy link

I have the same issue but in stories content.

@jtushman
Copy link
Owner

Cool. I'll get on this hopefully soon. PR are always appreciated. Is it really as simple as adding a u -- are there other approaches that we should consider?

@seniorio
Copy link
Author

Unfortunately I’m not a Python dev so don’t want to accidentally give bad advice; this is an interesting read: http://blog.notdot.net/2010/07/Getting-unicode-right-in-Python

I’ll keep looking for best-practices in the meantime and submit a PR if I find something.

Cheers!

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

3 participants
0