Closed
Bug 179392
Opened 23 years ago
Closed 22 years ago
nsITextToSubURI.ConvertAndEscape missing terminator with ISO-2022-JP
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
VERIFIED
FIXED
mozilla1.3alpha
People
(Reporter: shom, Assigned: nhottanscp)
Details
Attachments
(2 files)
4.02 KB,
text/plain
|
Details | |
1013 bytes,
patch
|
shanjian
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
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/
Reporter | ||
Comment 1•23 years ago
|
||
fromUnicodeForEscapes(str, encoding)
escapeRFC1738(str, encoding)
escapeRFC2718(str)
escapeECMA262 (str)
escapeJS12(str, enc)
![]() |
||
Comment 2•23 years ago
|
||
You can already do this from chrome JS. See
http://lxr.mozilla.org/seamonkey/source/intl/uconv/idl/nsITextToSubURI.idl#51
Summary: [RFE] some JavaScript escape() valiants → [RFE] some JavaScript escape() variants
Reporter | ||
Comment 3•23 years ago
|
||
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
Reporter | ||
Comment 4•23 years ago
|
||
modify summary
Summary: [RFE] some JavaScript escape() valiants → nsITextToSubURI.ConvertAndEscape missing terminator with ISO-2022-JP
![]() |
||
Comment 5•23 years ago
|
||
That would be an Intl bug.
Assignee: jst → smontagu
Status: UNCONFIRMED → NEW
Component: DOM Level 0 → Internationalization
Ever confirmed: true
QA Contact: desale → ylong
Assignee | ||
Updated•22 years ago
|
Target Milestone: --- → mozilla1.3alpha
Assignee | ||
Comment 7•22 years ago
|
||
Assignee | ||
Updated•22 years ago
|
Attachment #105913 -
Flags: review?(shanjian)
Comment 8•22 years ago
|
||
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+
Assignee | ||
Updated•22 years ago
|
Attachment #105913 -
Flags: superreview?(bzbarsky)
![]() |
||
Comment 9•22 years ago
|
||
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+
Assignee | ||
Comment 10•22 years ago
|
||
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
Comment 11•22 years ago
|
||
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.
Description
•