Closed
Bug 533142
Opened 15 years ago
Closed 15 years ago
network.standard-url.escape-utf8 has no effect
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: pluskid, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
When I set network.standard-url.escape-utf8 in about:config to false, I wish UTF-8 encoded characters not be escaped as %XX in URL. However, it seems no effect. After searching through the code, I found this snippet:
http://mxr.mozilla.org/firefox/source/netwerk/base/src/nsStandardURL.cpp#202
201 // escape per RFC2396 unless UTF-8 and allowed by preferences
202 PRInt16 escapeFlags = (gEscapeUTF8 || mEncoder) ? 0 : esc_OnlyASCII;
I think there's a typo in this code. The "||" should be "&&", isn't it? Unless gEscapeUTF8 is enabled *and* we have a good encoder, we'll not escape UTF-8. Please verify and fix this.
Reproducible: Always
Steps to Reproduce:
1. Use a simple HTTP server that prints the received URL path
2. Open a URL containing UTF-8 characters in Firefox
3. change network.standard-url.escape-utf8 option and open the URL again
Actual Results:
The path sent by Firefox are the same, all UTF-8 characters are escaped like %XX
Expected Results:
I expect no %XX escaping for UTF-8 characters when network.standard-url.escape-utf8 is set to false.
Comment 1•15 years ago
|
||
If the charset is UTF-8 (or indeed UTF-*), mCharset is empty and mEncoder will be null.
Consequently, that line of code is correct. We want to encode if we have a non-UTF-8 charset (=if mEncoder is non-null), or if we have UTF-8 charset and gEscapeUTF8 is true.
OK, sorry that I don't understand the codebase of Firefox and thus the noise.
However, it seems the problem is still there, the UTF-8 characters still get escaped even though network.standard-url.escape-utf8 is set to false. :-/
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•