The DOM Response `statusText` won't accept none latin characters
Reported by
jarro...@gmail.com,
Jan 13 2017
|
||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2970.0 Safari/537.36
Steps to reproduce the problem:
Create response object as follows:
new Response('test', {status: 403, statusText: 'В доступе отказано'});
What is the expected behavior?
Should create a Response object
What went wrong?
Throws TypeError: Failed to construct 'Response': Invalid statusText
Did this work before? N/A
Chrome version: 57.0.2970.0 Channel: dev
OS Version:
Flash Version: Shockwave Flash 24.0 r0
The issue was reported by one of my users. My app uses the Fetch API in (still) Chrome application. His server returns "403 В доступе отказано" status and my app generates an error when constructing the response.
The only TypeError related to this case I found in the spec is this:
If init’s statusText member does not match the reason-phrase token production, then throw a TypeError.
The reason-phrase is the status text part of the HTTP status line. I'm not sure how this affecting this. If I change status test from this example to anything else that contains latin characters only it works well.
,
Jan 16 2017
,
Jan 17 2017
Tested on windows 7 , ubuntu 14.04 and mac os 10.12.2 using chrome canary M57 #57.0.2984.0 and issue is reproduced. Issue is seen from M30 #30.0.1549.0 and is a non-regression issue , Marking it as untraiged. Thanks!
,
Jan 17 2017
On Firefox:
>> new Response('', {statusText: '大学院'})
TypeError: Cannot convert string to ByteString because the character at index 0 has value 22823 which is greater than 255.
,
Jan 20 2017
According to https://heycam.github.io/webidl/#es-ByteString Firefox's behaviour is correct. The statusText is treated as a string of bytes, not characters. If you want to put UTF-8 in there, you need to encode the UTF-8 to bytes using TextEncoder and then put those bytes in a string. Closing as Working As Intended. |
||||
►
Sign in to add a comment |
||||
Comment 1 by dtapu...@chromium.org
, Jan 13 2017