Default encoding of Python 3's open() under Windows. sys.getdefaultencoding() setting not respected

后端 未结 1 1388
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 18:00

I\'ve been pulling my hair out over this issue for several hours now.

I have a message file I want to generate using django\'s makemessages command, which works just

1条回答
  •  北海茫月
    2021-01-18 18:27

    Try this

    import locale
    locale.setlocale(locale.LC_ALL, 'en_US.utf-8')
    

    0 讨论(0)
提交回复
热议问题