Closed Bug 637251 Opened 13 years ago Closed 2 years ago

fileField can display non-ascii characters incorrectly (In Thunderbird, the file name is garbled in Photo tab of a contact)

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: eagle.lu, Unassigned)

Details

(Keywords: intl)

Attachments

(1 file, 2 obsolete files)

locale: zh-CN.UTF-8

Steps to reproduce:

1)Launch #thunderbird
2)Create a New Contact from File->New->Address Book Contact
3)Input the contact details and in Photo tab select a localized image file in "On this computer" field

Result: Localized image filename is garbled in this field
Assignee: nobody → brian.lu
Attachment #515570 - Flags: review?(bugzilla)
Comment on attachment 515570 [details] [diff] [review]
set filefield label to path name explicitly

Whilst this works around the issue, I'm not convinced it is the correct fix. The really issue appears to be here:

http://hg.mozilla.org/mozilla-central/annotate/1240004b90e6/toolkit/content/widgets/filefield.xml#l71

nsIURL.fileName may contain escaped characters. So if we don't want to display escaped characters I think that is the place where it looks like we should fix it.

Fixing the core issue would also fix the case where we're re-opening the dialog, which this patch currently misses.
Attachment #515570 - Flags: review?(bugzilla) → review-
Keywords: intl
Looks like this is a bug in the <filefield> implementation - it gets the name by converting the file to a URL (!) which encodes non-ascii characters.
Looks like the code did this ever since Ben's first check in 6 years ago.
Attached patch fix in filefield (obsolete) — Splinter Review
Attachment #515570 - Attachment is obsolete: true
Attachment #519343 - Flags: review?(neil)
Comment on attachment 519343 [details] [diff] [review]
fix in filefield

>+          let lf = aFile.QueryInterface(Components.interfaces.nsILocalFile);
You don't need nsILocalFile; path is an attribute on nsIFile. Also newFileURI will already fail if aFile isn't an nsIFile, so you don't need both cases.

>+            return lf.path;
Did you mean the whole path? I would have thought the leafName would suffice (leafName is also an attribute on nsIFile of course).
Attachment #519343 - Flags: review?(neil) → review-
Attachment #519343 - Attachment is obsolete: true
Attachment #519582 - Flags: review?(neil)
Attachment #519582 - Flags: review?(neil) → review+
As this is really a bug in toolkit, moving to the toolkit product.
Component: Address Book → XUL Widgets
Product: Thunderbird → Toolkit
QA Contact: address-book → xul.widgets
Summary: [thunderbird]file name is garbled in Photo tab of a contact → fileField can display non-ascii characters incorrectly (In Thunderbird, the file name is garbled in Photo tab of a contact)
OS: Linux → All
Hardware: x86 → All

The bug assignee didn't login in Bugzilla in the last 7 months.
:mstriemer, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: eagle.lu → nobody
Flags: needinfo?(mstriemer)

I can't find the file that was patched here.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(mstriemer)
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: