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

Better Unicode detection #10

Closed
asmeurer opened this issue Jun 4, 2014 · 3 comments
Closed

Better Unicode detection #10

asmeurer opened this issue Jun 4, 2014 · 3 comments

Comments

@asmeurer
Copy link
Contributor

asmeurer commented Jun 4, 2014

My terminal supports Unicode, but pyinstrument doesn't use it.

SymPy's Unicode detection seems to be pretty robust (there are tons of users, and the only error reports about misusing Unicode when it isn't supported that I notice are from non-Terminals). It seems to be a combination of doing a unicodedata lookup and trying sys.stdout.encode. I also don't know if it makes sense to restrict unicode output to ttys. That generally only matters for colors, because the ANSI escape sequences might not be interpreted otherwise, and will just clutter the output.

The code's all BSD, so feel free to reuse it.

@joerick
Copy link
Owner

joerick commented Jun 6, 2014

I've made some changes to the unicode detection, the code is on my develop branch. It should work better than the previous detection mechanism.

Does this work at your end?

@asmeurer
Copy link
Contributor Author

asmeurer commented Jun 6, 2014

Yes, it uses Unicode for me now.

@asmeurer
Copy link
Contributor Author

asmeurer commented Jun 6, 2014

And I just tried it in a terminal that only supports ASCII and it correctly doesn't use Unicode.

@joerick joerick closed this as completed in 61b8821 Jun 6, 2014
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