Django中在使用HttpResponseRedirect的时候,跳转URL中如果存在中文,会报错:会报UnicodeEncodeError错误。

解决办法:
使用urlquote对URL进行编码

from django.utils.http import urlquote

return HttpResponseRedirect(urlquote("/wiki/%s" % page.pagename))

相关文章:

  • 2021-06-12
  • 2022-01-08
  • 2021-12-04
  • 2022-02-26
  • 2022-01-13
猜你喜欢
  • 2021-06-11
  • 2021-11-19
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-08-23
相关资源
相似解决方案