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

Problems with unicode on Windows. #70

Closed
lk-geimfari opened this issue Dec 22, 2016 · 2 comments
Closed

Problems with unicode on Windows. #70

lk-geimfari opened this issue Dec 22, 2016 · 2 comments

Comments

@lk-geimfari
Copy link
Owner

lk-geimfari commented Dec 22, 2016

JeStoneDev from a habr has following:

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from elizabeth import Personal
>>> user = Personal('is')
>>> for _ in range(0, 9):
...     print(user.full_name(gender='male'))
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Users\mainj\AppData\Local\Programs\Python\Python35-32\lib\encodings\cp437.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xf0' in position 5: character maps to <undefined>

So, if your machine on Windows 10 then, please, try to fix it.

@lk-geimfari lk-geimfari added the help wanted Nee help label Dec 22, 2016
@mipaaa
Copy link
Contributor

mipaaa commented Dec 22, 2016

You should switch the console code page to UTF-8 before running such a code:

C:\Test\Elizabeth> chcp 65001
65001

C:\Test\Elizabeth> py
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from elizabeth import Personal
>>> user = Personal('is')
>>> for _ in range(0, 4):
...     print(user.full_name(gender='male'))
...
Oddmar Sandrason
Þiðrandi Ófeigsson
Ljúfur Ófeigsson
Nikolai Skæringsson
>>>

@lk-geimfari
Copy link
Owner Author

@mipaaa Thank you!

@lk-geimfari lk-geimfari added done and removed help wanted Nee help labels Dec 22, 2016
@lk-geimfari lk-geimfari reopened this Dec 22, 2016
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