Force manage.py to output UTF-8 to avoid UnicodeEncodeErrors
|Reported by:||anonymous||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||master|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Got the following Unicode error while trying to run: ./manage sqlall ws with the workstyle-py application.
(Btw the application is writen for Django-0.91 and i found this error while porting it to Django-trunk)
The application tries to insert some Japanese (UTF-8) data into the database while running sqlall.
But the console running the ./manage.py command default to ASCII not UTF-8, thus raises an UnicodeEncodeError.
I figure that since Django should be full unicode now this should work and print out UTF-8 (or at least not raise an EncodeError)
The attached path forces the output print stream into UTF-8.
Hopefully this helps other people with Unicode problems on the console with SQL.
Traceback (most recent call last): File "./manage.py", line 11, in ? execute_manager(settings) File "/var/www/site/webapp/__init__.py", line 274, in execute_manager File "/var/www/site/webapp/__init__.py", line 224, in execute File "/usr/lib/python2.4/site-packages/django/core/management/base.py", line 71, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib/python2.4/site-packages/django/core/management/base.py", line 94, in execute print(txt) UnicodeEncodeError: 'ascii' codec can't encode characters in position 66-68: ordinal not in range(128)
Change History (6)
Changed 7 years ago by anonymous
comment:1 Changed 7 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 7 years ago by Simon G <dev@…>
- Component changed from Uncategorized to django-admin.py
- Summary changed from UnicodeEncodeError in manage.py sqlall on project with utf8 data to Force manage.py to output UTF-8 to avoid UnicodeEncodeErrors
- Triage Stage changed from Unreviewed to Design decision needed
comment:3 Changed 4 years ago by russellm
- Resolution set to worksforme
- Status changed from new to closed
comment:4 Changed 3 years ago by joni
- Easy pickings unset
- Resolution worksforme deleted
- Severity set to Normal
- Status changed from closed to reopened
- Type set to Uncategorized
- UI/UX unset