Changes between Initial Version and Version 1 of Ticket #32439


Ignore:
Timestamp:
Feb 12, 2021, 3:59:35 AM (4 years ago)
Author:
helmstedt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32439 – Description

    initial v1  
    55The reason for the error is, I think, described in https://stackoverflow.com/questions/64457733/django-dumpdata-fails-on-special-characters/65186947#65186947 with a "hacky" solution. I quote:
    66
    7 "To save json data in django the TextIOWrapper is used:
     7   "To save json data in django the TextIOWrapper is used:
    88
    99    The default encoding is now locale.getpreferredencoding(False) (...)
    1010
    11 In documentation of locale.getpreferredencoding fuction we can read:
     11   In documentation of locale.getpreferredencoding fuction we can read:
    1212
    1313    Return the encoding used for text data, according to user preferences. User preferences are expressed differently on different systems, and might not be available programmatically on some systems, so this function only returns a guess.
    1414
    15 Here I found "hacky" but working method to overwrite these settings:
     15    Here I found "hacky" but working method to overwrite these settings:
    1616
    17 In file settings.py of your django project add these lines:
     17    In file settings.py of your django project add these lines:
    1818
    19 import _locale
    20 _locale._getdefaultlocale = (lambda *args: ['en_US', 'utf8'])"
     19    import _locale
     20   _locale._getdefaultlocale = (lambda *args: ['en_US', 'utf8'])"
    2121
    2222In Python I can my "inspect _locale._getdefaultlocale" variable in my (Danish) Windows installation:
Back to Top