Closed Bug 179392 Opened 23 years ago Closed 22 years ago

nsITextToSubURI.ConvertAndEscape missing terminator with ISO-2022-JP

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.3alpha

People

(Reporter: shom, Assigned: nhottanscp)

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.1) Gecko/20021030 for VineLinux 0vl6 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.1) Gecko/20021030 for VineLinux 0vl6 JavaScript escape() in HTML page is compatible with NC4.x (bug 22594), but it is unusable in XUL js when encode with a charset. Reproducible: Always Steps to Reproduce: var str = "\u3042"; 1. escape(str); 2. escape(scriptableUnicodeConverter.fromUnicode(str)) with charset="EUC-JP" (I think it is invalid because the argument of escape() shuld be UCS-2)1. Actual Results: 1. %E3%81%82 : it is escaped with UTF-8 (valid) 2. %C3%A3%C2%81%C2%82 : it is invalid, naturally Expected Results: ex) NC4.x(JP) escapes \u3042 to - %C2%A4 from charset=EUC-JP pages - %82%A0 from charset=Shift_JIS pages - %1B%24B%24%22%1B%28B from charset=ISO-2022-JP pages And many many sites (except for IIS) expects escaped queries in this way. But I found no such methods. I can not generate URIs include escaped Japanese (and Chinese, Korean) with any encodings expcept UTF-8. I made some escape() valiants which are usable in XUL js. escapeJS12(str, encoding) --- compatible with JavaScript 1.2, 1.3, 1.4 escapeRFC1738(str, encoding) --- RFC1738 escape method escapeRFC2718(str) --- RFC2718 + RFC1738 (UTF-8 escaped with RFC1738) escapeECMA262(str) --- ECMA-262 3rd escape() str should be UCS-2. tested on http://shom.homelinux.org/~shom/mozilla/testcases/escapetest/
Attached file escapes.js
fromUnicodeForEscapes(str, encoding) escapeRFC1738(str, encoding) escapeRFC2718(str) escapeECMA262 (str) escapeJS12(str, enc)
Summary: [RFE] some JavaScript escape() valiants → [RFE] some JavaScript escape() variants
Oooops..... My outlook was narrow.... It is usable except ISO-2022-JP terminator bug(related bug 114923). exepcted: escapeJS12(<ISO-2022-JP>):-%1B%24B%24%22%24%24%24%26%24%28%1B%28B actual: escapeUI (<ISO-2022-JP>):-%1B%24B%24%22%24%24%24%26%24%28 in ISO-2022-JP, the string should be terminated in ASCII mode "<ESC>(B"
Summary: [RFE] some JavaScript escape() variants → [RFE] some JavaScript escape() valiants
modify summary
Summary: [RFE] some JavaScript escape() valiants → nsITextToSubURI.ConvertAndEscape missing terminator with ISO-2022-JP
That would be an Intl bug.
Assignee: jst → smontagu
Status: UNCONFIRMED → NEW
Component: DOM Level 0 → Internationalization
Ever confirmed: true
QA Contact: desale → ylong
reassign to nhotta
Assignee: smontagu → nhotta
Target Milestone: --- → mozilla1.3alpha
Attachment #105913 - Flags: review?(shanjian)
Comment on attachment 105913 [details] [diff] [review] Call nsIUnicharEncoder::Finish to ensure the converted string is terminated. r=shanjian,
Attachment #105913 - Flags: review?(shanjian) → review+
Attachment #105913 - Flags: superreview?(bzbarsky)
Comment on attachment 105913 [details] [diff] [review] Call nsIUnicharEncoder::Finish to ensure the converted string is terminated. sr=bzbarsky, but I various other places in the tree (eg nsFormSubmission) that are not calling Finish(). Please check all nsIUnicodeEncoder users to make sure they are calling Finish() properly when they should be.... (and file bugs on the ones that are not)
Attachment #105913 - Flags: superreview?(bzbarsky) → superreview+
checked in to the trunk bug 179955 was filed for the remaining parts which do not call nsIUnicharEncoder::Finish(). nsFormSubmission.cpp does not use nsIUnicharEncoder.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Verified fixed in 11-20 trunk build / WinXP, there is no more terminator missed with escaped iso-2022-jp string.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: