Changes between Version 1 and Version 2 of Ticket #26731, comment 3
- Timestamp:
- Jun 8, 2016, 3:27:06 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26731, comment 3
v1 v2 1 1 The string came from the db. The actual error came from django/core/management/base.py", line 111, in write. 2 2 3 I fixed my specific issue by importing unicode literals and using `self.stdout.write('{}'.format( unicode_string))`. I'm afraid my understanding of python's unicode string handling isn't great. Perhaps the answer is to update the documentation to suggest using unicode literals in management commands - the alternative is a nasty surprise waiting to happen in production (as it did to me!)3 I fixed my specific issue by importing unicode literals and using `self.stdout.write('{}'.format(possibly_unicode_string_from_db))`. I'm afraid my understanding of python's unicode string handling isn't great. Perhaps the answer is to update the documentation to suggest using unicode literals in management commands - the alternative is a nasty surprise waiting to happen in production (as it did to me!)