Closed Bug 537216 Opened 11 years ago Closed 11 years ago

Unicode URLs are escaped in print titles

Categories

(Core :: Printing: Output, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- .5-fixed

People

(Reporter: panemade, Assigned: smontagu)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091216 Fedora/3.5.6-1.fc12 Firefox/3.5.6
Build Identifier: 

On Fedora 12 system where I have
cairo-1.8.8-3.fc12.x86_64
firefox-3.5.6-1.fc12.x86_64


Reproducible: Always

Steps to Reproduce:
1) start firefox and enter URL http://mr.wikipedia.org
2) print this page as pdf


Actual Results:  
Unable to see Unicode string मुखपृष्ठ printed as URL address in pdf



Expected Results:  
It should display Unicode string and not its hex representation.
This should probably be fixed in nsPrintEngine::GetDisplayTitleAndURL(). 

This function ultimately calls nsIPrintSettings::GetDocURL(), which seems to be implemented by both nsIPrintProgressParams and nsPrintSettings. Both of these return the docURI via ToNewUnicode(), which does nothing but copy the buffer. I believe what is needed to fix this is to call nsTextToSubURI::convertURItoUnicode() which actually decodes a URI to an IRI so that it may be displayed in the print settings properly.
This happens with all printing, not just pdf
Assignee: nobody → smontagu
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Summary: unable to see webpage URL Unicode string in pdf → Unicode URLs are escaped in print titles
Attached patch PatchSplinter Review
I'm not sure if the assumption that the URL is in UTF-8 is safe (though the existing code seems to make the same assumption).
Attachment #419872 - Flags: review?(roc)
Comment on attachment 419872 [details] [diff] [review]
Patch

+    textToSubURI->UnEscapeURIForUI(nsDependentCString("UTF-8"),
+                                   urlCStr, unescapedURI);

NS_LITERAL_CSTRING. And check for failure here?

+  } else {
+    *aURLStr = UTF8ToNewUnicode(urlCStr);
+  }

Don't bother. Just return an empty string.
Flags: in-litmus?
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
can this fix be backported on 1.9.2?
Version: unspecified → Trunk
Comment on attachment 419872 [details] [diff] [review]
Patch

Requesting approval1.9.2.1 after trunk baking. This is a big win for UE and usability when printing URLs with non-Latin titles, and the risk is minimal because we're only modifying one string, which is only used within the printing UI.
Attachment #419872 - Flags: approval1.9.2.1?
Comment on attachment 419872 [details] [diff] [review]
Patch

We'll take this in 1.9.2.3 when the tree is open for that build; pretty simple patch, nice thing to do for non-Latin alphabeteers.
Attachment #419872 - Flags: approval1.9.2.3?
Attachment #419872 - Flags: approval1.9.2.2?
Attachment #419872 - Flags: approval1.9.2.2-
Comment on attachment 419872 [details] [diff] [review]
Patch

a=LegNeato for 1.9.2.5. Please ONLY land this on mozilla-1.9.2 default, as we
are still working on 1.9.2.4 on the relbranch
Attachment #419872 - Flags: approval1.9.2.4? → approval1.9.2.5+
You need to log in before you can comment on or make changes to this bug.