#181117 Non-ASCII(plane 1 surrogate) link not correctly parsed in UTF-16

if the doc charset is utf-16 or utf-32,use utf8 for url encoding.
r=nhotta, sr=darin


git-svn-id: svn://10.0.0.236/trunk@134442 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shanjian%netscape.com
2002-11-26 04:42:30 +00:00
parent c4d51e9545
commit 7beea85904

View File

@@ -88,6 +88,13 @@ NS_MakeAbsoluteURIWithCharset(nsACString &aResult,
if (aDocument && NS_FAILED(aDocument->GetDocumentCharacterSet(originCharset)))
originCharset.Truncate();
// URI can't be encoded in UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32-LE,
// UTF-32LE, UTF-32BE (yet?). Truncate it and leave it to default (UTF-8)
if (originCharset[0] == 'U' &&
originCharset[1] == 'T' &&
originCharset[2] == 'F')
originCharset.Truncate();
rv = nsHTMLUtils::IOService->NewURI(NS_ConvertUCS2toUTF8(aSpec),
NS_LossyConvertUCS2toASCII(originCharset).get(),
aBaseURI, getter_AddRefs(absURI));