Closed Bug 580254 Opened 16 years ago Closed 16 years ago

FireFox always convert Chinese into GB2312 encoding in URL

Categories

(Core :: Internationalization, defect)

1.9.2 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 552273

People

(Reporter: sunht, Assigned: smontagu)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 In the address bar, giving the URL with Chinese character, and press the enter key, all Chinese characters will be converted to %DD with GB2312 encoding. For example, the URL above: http://www.google.com/dictionary?aq=f&langpair=en|zh-CN&q=测试&hl=en it will be automatically converted to: http://www.google.com/dictionary?aq=f&langpair=en|zh-CN&q=%B2%E2%CA%D4&hl=en I tested in Chome, Safari, IE, Chome and Safari also: Chome: the chinese characters will be kept, and Google Translate working fine Safari: same as Chome IE: wired, chinese character kept in the address bar, while the translate working wrongly, means actually data sending to server using encoding data, just showing properly. FireFox: Chinese characters converted with GB2312 encoding (always), and sending this data to the server, then Google Translate broken. Reproducible: Always Steps to Reproduce: 1. Put the http://www.google.com/dictionary?aq=f&langpair=en|zh-CN&q=%E6%B5%8B%E8%AF%95&hl=en in the address bar 2. Press Enter Actual Results: The Chinese characters are converted using GB2312 encoding, and sending to the server (I checked this by validate the FireFox URL using the my local servlet). Expected Results: The URL should kept as it is, (or using UTF-8 encoding?) I have written a cover page, which has a HREF jump using the same URL with Chinese character, and it will work, but again, if I hit the press bar, it will be failed again. <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <a href="http://www.google.com/dictionary?aq=f&langpair=en|zh-CN&q=测试&hl=en">Goto Google Dict with Chinese</a>. </body> </html>
Searched with Google, looks like someone else reports similar behavior changed between FireFox 2 and FireFox 3: http://forums.mozillazine.org/viewtopic.php?f=9&t=743305
Just write a servlet and test what the server side received: From the server side, the data received as a byte flow encoding with ISO_8859_1, first decode with ISO_8859_1 into byte array, and then, encoding using GB2312, then get the right Chinese characters.
non-Ascii chars are illegal in an URL and they have to be escaped. HTML4 allows UTF-8 and that is the reason why the html anchor works I think this report is invalid
Component: Location Bar → Networking: HTTP
Product: Firefox → Core
QA Contact: location.bar → networking.http
Version: unspecified → 1.9.2 Branch
Well. There's the question of why we're encoding using GB2312. That seems bogus to me. But that happens _way_ before we ever get to the HTTP layer. It might be nsStandardURL, of course....
Assignee: nobody → smontagu
Component: Networking: HTTP → Internationalization
QA Contact: networking.http → i18n
Thanks for your time on this item reported. The background is that I'm currently working on a services which are responding the requests via Get method. Agree with Boris, the trouble for me is GB2312, since this is just the standard for Chinese characters. If the URL are mixed with Chinese and Japanese, then, which encoding expected? If it can be neutral to Language, say UTF-8, that will be great. Also, I have observed that if jump from another page, the Unicode chars will be left un-converted, this only happens while the manual input in the address bar, then press enter. So, I'm guessing, it's address bar which convert based on the best encoding it believes right. So, the fix I'm looking for is: for unicode chars, left as untouched or always encoding as UTF-8, and sending to server always using UTF-8, that will be great.
I can't reproduce the bug except by faking it: overriding the encoding of http://google.com/dictionary to GB2312, entering Chinese characters into the text box and pressing Search. From the address bar I always get UTF-8. Can you try creating a new profile and re-testing with that?
What you have done is right: Put the Chinese into the text box and pressing search the URL will have UTF-8, since this is triggered from the web pages. Then, don't do any changes, focus on the address bar, and press enter key. The page will be refreshed, and the Chinese characters will convert into %dd%dd My system is: Windows 7 (x32) English version (ultimate) Region and Language setting: Formats: Englisn (Unite States) Location: Hong Kong Keyboards and Languages: Language for non-Unicode programs: my settings is Chinese (Simplified, PRC). I guess that last one make the problem, because that one is said as GB2312. FireFox may read that one and convert? (not sure). For me, that one to be set as Chinese, because some legacy application don't support unicode.
I just tried in another machine which has Keyboards and language settings: Language for Non-Unicode program: English-US. The Chinese characters will be kept as it is in the address bar now. And more than that, while copying the address bar content out and paste back, the URL will be automatically converted UTF-8 encoding! And one more thing is: while pressing the Enter key, all those UTF-8 encoding stuff will be automatically converted back to Chinese character (means %dd disappeared, and Chinese chars back). So, here is the more specific issue description: While the OS (Windows) set the default encoding page for non-unicode characters, it impacts the behavior of address bar of FireFox, and makes it working unpredictable? (like if mixed with Chinese and Japanese, what's the encoding will be used?) The suggested fix would be: what ever settings it is, always UTF-8, then the whole behavior is predictable?
BTW: after changed the settings, the page with title as Chinese will be displayed as ??? in the title bar, while all contents are displaying good.
OK, I managed to reproduce this on Windows with the default encoding for non-unicode programs set to Chinese (Simplified, PRC). (In reply to comment #8) > The suggested fix would be: what ever settings it is, always UTF-8, then the > whole behavior is predictable? You can get this behaviour by setting network.standard-url.encode-query-utf8 to true in about:config.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.