Skip to content

Commit 11dda9e

Browse files
[3.13] gh-149144: Use decodeURIComponent() for UTF-8 support in js_output() (GH-149157)
(cherry picked from commit 461b1d9)
1 parent 1d0cf31 commit 11dda9e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/http/cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def output(self, attrs=None, header="Set-Cookie:"):
388388
def __repr__(self):
389389
return '<%s: %s>' % (self.__class__.__name__, self.OutputString())
390390

391-
def _js_output(self, attrs=None):
391+
def js_output(self, attrs=None):
392392
import urllib.parse
393393
# Print javascript
394394
output_string = self.OutputString(attrs)

Lib/test/test_http_cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def test_load(self):
163163
""")
164164
cookie_encoded = urllib.parse.quote('Customer="WILE_E_COYOTE"; Path=/acme', safe='', encoding='utf-8')
165165
self.assertEqual(C.js_output(['path']), fr"""
166-
script type="text/javascript">
166+
<script type="text/javascript">
167167
<!-- begin hiding
168168
document.cookie = decodeURIComponent("{cookie_encoded}");
169169
// end hiding -->

0 commit comments

Comments
 (0)