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

Chinese Display Error, unreadable code, how ? #28

Open
gaopengpian opened this issue Jul 4, 2016 · 5 comments
Open

Chinese Display Error, unreadable code, how ? #28

gaopengpian opened this issue Jul 4, 2016 · 5 comments

Comments

@gaopengpian
Copy link

pg = Spinner('中文')
pg.finish()

@verigak
Copy link
Owner

verigak commented Sep 18, 2016

Seems to work for me. Can you try this example and let me know if it works?

from progress.spinner import Spinner
import time

pg = Spinner('中文')
for i in range(20):
    time.sleep(0.1)
    pg.next()
pg.finish()

@gaopengpian
Copy link
Author

gaopengpian commented Jan 23, 2017

I am so sorry for no reply for a long time, thanks for you reply. I have tested the code above, the error is still on.
image

@skalkoto
Copy link

This has nothing to do with the progress module. The python parser cannot parse your test.py file because it has Non-ASCII characters inside (namely '中文') and there is no encoding declared. Try adding something like this:

# -*- coding: utf-8 -*-

in the beginning of the file. Check PEP 263 (https://www.python.org/dev/peps/pep-0263/) for more info.

@gaopengpian
Copy link
Author

I add the coding, but the output is unreadable code.
image

@skalkoto
Copy link

I have no experience with Windows and I don't know if your file's encoding is actually UFT-8 but if I had to guess about your problem I would say that the software is using ANSI escape characters, that from what I read here: https://en.wikipedia.org/wiki/ANSI_escape_code are not working on Windows:

Although hardware text terminals have become increasingly rare in the 21st century, the relevance of the ANSI standard persists because most terminal emulators interpret at least some of the ANSI escape sequences in the output text. One notable exception was the Win32 console component of Microsoft Windows before Windows 10 update TH2.

Maybe check this thread: http://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences

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