Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#19487 closed Bug (fixed)

WSGI environ contains unicode strings

Reported by: aaugustin Owned by: nobody
Component: Python 2 Version: master
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

PEP 3333 says it should contain native strings (str objects).

This is a regression introduced by the unicode_literals patch. It only affects Python 2.

Change History (6)

comment:1 Changed 3 years ago by aaugustin

Pull request fixing this issue as well as #19468: https://github.com/django/django/pull/596

comment:2 Changed 3 years ago by claudep

Aymeric, you know my opinion on using settings.DEFAULT_CHARSET to decode URLs. This will work for the majority of people which do not touch this setting. But for those who customized it, Django will still encode the URL's in UTF-8, so the decoding will probably fail. settings.DEFAULT_CHARSET is really about response encoding, not much else (see #4380).

comment:3 Changed 3 years ago by claudep

My latest comment affects only the second commit of your PR, of course. First one is probably RFC.

comment:4 Changed 3 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

In db22145afb9623fdcaa4269b5eefa045320e028e:

[1.5.x] Fixed #19487 -- Used str in the test client's WSGI environ.

This regression was introduced by the unicode_literals patch. The WSGI
spec mandates that environ contains native strings.

Backport of d9a0b6a.

comment:6 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>

In d9a0b6ab36b6beb4251acf1de1fdf255e1223e02:

Fixed #19487 -- Used str in the test client's WSGI environ.

This regression was introduced by the unicode_literals patch. The WSGI
spec mandates that environ contains native strings.

Note: See TracTickets for help on using tickets.
Back to Top