[Django] #30324: I found an error related to Unicode.

13 views
Skip to first unread message

Django

unread,
Apr 3, 2019, 3:52:23 PM4/3/19
to django-...@googlegroups.com
#30324: I found an error related to Unicode.
-------------------------------------+-------------------------------------
Reporter: chihun- | Owner: (none)
jang |
Type: Bug | Status: new
Component: Error | Version: 2.2
reporting | Keywords: runserver,
Severity: Normal | UnicodeDecodeError,
Triage Stage: | cp949,template,technical_500
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
While studying Django, I had an error where the technical_500.html page
was not properly printed.


[[Image(https://2.bp.blogspot.com/-JFSh6RRcMbs/XKUCH5KmcMI/AAAAAAAA8TU/ZC-
b4fJJNL0auiAtl2fDSMfBf3nAudhtACEwYBhgL/s1600/unicode%2Berror.png)]]
In the log window, UnicodeDecodeError was continuously printed, and in the
template, the sentence 'A server error occured. Please contact the
administrator' was printed

So when I checked the technical_500.html file of Django 2.2version, I
found that the dotdotdot wrapped by the <span>tag on the 239th line was
changed to ellipsis.

[[Image(https://4.bp.blogspot.com/-l8Jae3-q2aY/XKUCGVUX2VI/AAAAAAAA8TU/Gv_eoeessEIoIVZ_xJMsEaO9NqpIQmLhQCEwYBhgL/s1600/diffrent%2Btext.png)]]

Apparently, the version of Django 2.1.8 was a dotdotdot.

So I took steps to change the 239th line's ellipsis to dotdotdot.

Or, when reading the technical_500.html file from inside the debug.py
file, the encoding format was set to utf-8.

[[Image(https://1.bp.blogspot.com/-7X1UZVMZy58/XKUCGdbtVAI/AAAAAAAA8TM/1SdjeDtkuXYt8v0Q__zYDZwvMTesvlciQCEwYBhgL/s1600/add%2Bencoding%2Boption.png)]]


This enabled me to resolve the error.

Did you intentionally modify the technical_html file?

--
Ticket URL: <https://code.djangoproject.com/ticket/30324>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 3, 2019, 4:16:25 PM4/3/19
to django-...@googlegroups.com
#30324: I found an error related to Unicode.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 2.2
Severity: Normal | Resolution: fixed
Keywords: runserver, | Triage Stage:
UnicodeDecodeError, | Unreviewed
cp949,template,technical_500 |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by chihun-jang):

* status: new => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:1>

Django

unread,
Apr 3, 2019, 4:54:46 PM4/3/19
to django-...@googlegroups.com
#30324: I found an error related to Unicode.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: (none)
Type: Bug | Status: new

Component: Error reporting | Version: 2.2
Severity: Normal | Resolution:
Keywords: runserver, | Triage Stage:
UnicodeDecodeError, | Unreviewed
cp949,template,technical_500 |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by chihun-jang):

* status: closed => new
* resolution: fixed =>


--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:2>

Django

unread,
Apr 3, 2019, 4:55:00 PM4/3/19
to django-...@googlegroups.com
#30324: I found an error related to Unicode.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: chihun-
| jang
Type: Bug | Status: assigned

Component: Error reporting | Version: 2.2
Severity: Normal | Resolution:
Keywords: runserver, | Triage Stage:
UnicodeDecodeError, | Unreviewed
cp949,template,technical_500 |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by chihun-jang):

* owner: (none) => chihun-jang
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:3>

Django

unread,
Apr 3, 2019, 7:47:16 PM4/3/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope

Type: Bug | Status: assigned
Component: Error reporting | Version: 2.2
Severity: Normal | Resolution:
Keywords: runserver, | Triage Stage: Accepted
UnicodeDecodeError, |
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* owner: chihun-jang => Nick Pope
* has_patch: 0 => 1
* easy: 1 => 0
* stage: Unreviewed => Accepted


Comment:

The issue here is that reading the various debug templates was changed in
[https://github.com/django/django/commit/ea542a9c7239b5b665797b7c809f1aceb0b412cf
ea542a9] to bypass the template loaders. The template loaders use the
encoding specified on the template engine which is utf-8 by default. Later
in
[https://github.com/django/django/commit/50b8493581fea3d7137dd8db33bac7008868d23a
50b8493] an ellipsis was added and this caused things to blow up on
Windows as `locale.getpreferredencoding(False)` is not utf-8.

Here is an alternative [https://github.com/django/django/pull/11170 PR]
that adds tests and a release note for 2.2.1 as this is a regression.

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:4>

Django

unread,
Apr 4, 2019, 2:00:57 AM4/4/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: assigned
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution:

Keywords: runserver, | Triage Stage: Accepted
UnicodeDecodeError, |
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* severity: Normal => Release blocker


Comment:

Upgrading to Release Blocker. Thanks for the report!

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:5>

Django

unread,
Apr 4, 2019, 2:43:19 AM4/4/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: assigned
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution:
Keywords: runserver, | Triage Stage: Accepted
UnicodeDecodeError, |
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

Original ticket that describes the same issue #30303.

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:6>

Django

unread,
Apr 5, 2019, 5:52:32 AM4/5/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: assigned
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution:
Keywords: runserver, | Triage Stage: Ready for
UnicodeDecodeError, | checkin
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:7>

Django

unread,
Apr 5, 2019, 10:35:39 AM4/5/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: closed

Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution: fixed

Keywords: runserver, | Triage Stage: Ready for
UnicodeDecodeError, | checkin
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"6b4e57d79f49b3dfb297505840663ee13d7cf500" 6b4e57d7]:
{{{
#!CommitTicketReference repository=""
revision="6b4e57d79f49b3dfb297505840663ee13d7cf500"
Refs #30324 -- Forced utf-8 encoding when loading templates for the
technical 404 debug and congrats page.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:9>

Django

unread,
Apr 5, 2019, 10:35:40 AM4/5/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: closed
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution: fixed
Keywords: runserver, | Triage Stage: Ready for
UnicodeDecodeError, | checkin
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson <carlton.gibson@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"efb257a01764855a71051d5bcc7fd66c5ad6d210" efb257a0]:
{{{
#!CommitTicketReference repository=""
revision="efb257a01764855a71051d5bcc7fd66c5ad6d210"
Fixed #30324 -- Forced utf-8 encoding when loading the template for the
technical 500 debug page.

Regression in 50b8493.
Related to ea542a9.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:8>

Django

unread,
Apr 5, 2019, 10:38:31 AM4/5/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: closed
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution: fixed
Keywords: runserver, | Triage Stage: Ready for
UnicodeDecodeError, | checkin
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"9da25fb832ae9db1a26f3796dcc9df2546d04f2f" 9da25fb]:
{{{
#!CommitTicketReference repository=""
revision="9da25fb832ae9db1a26f3796dcc9df2546d04f2f"
[2.2.x] Fixed #30324 -- Forced utf-8 encoding when loading the template


for the technical 500 debug page.

Regression in 50b8493.
Related to ea542a9.

Backport of efb257a01764855a71051d5bcc7fd66c5ad6d210 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:10>

Django

unread,
Apr 9, 2019, 10:04:58 PM4/9/19
to django-...@googlegroups.com
#30324: UnicodeDecodeError when loading debug templates.
-------------------------------------+-------------------------------------
Reporter: chihun-jang | Owner: Nick Pope
Type: Bug | Status: closed
Component: Error reporting | Version: 2.2
Severity: Release blocker | Resolution: fixed
Keywords: runserver, | Triage Stage: Ready for
UnicodeDecodeError, | checkin
cp949,template,technical_500 |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by zhangplusone):

{{{
<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id
}}')"><pre>{{ frame.context_line }}</pre>{% if not is_email %}
<span>…</span>{% endif %}</li>
}}}

On line 239, there is a special characters "…", or you can replace it with
"..."

--
Ticket URL: <https://code.djangoproject.com/ticket/30324#comment:11>

Reply all
Reply to author
Forward
0 new messages