search

Home  >  Q&A  >  body text

python - django 中的 views 输出编码问题

model 中有
city = models.CharField(max_length=50)
在 views 中输出的内容是 \u5e7f\u5dde ,如何将此直接输出为广州

阿神阿神2905 days ago508

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 10:29:11

    Use python 3, once and for all!

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 10:29:11

    There are three types of encoding, one is input encoding, one is code file encoding, and one is console encoding. Is my understanding wrong? The encoding should be consistent. The default string of Python2 is unicode, you can try __future__ unicode_literals

    reply
    0
  • Cancelreply