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

NEW
Assigned to

Status

()

Toolkit
XUL Widgets
7 years ago
3 years ago

People

(Reporter: Boying Lu, Assigned: Boying Lu)

Tracking

({intl})

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

7 years ago
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)

Comment 1

7 years ago
Created attachment 515570 [details] [diff] [review]
set filefield label to path name explicitly
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

Comment 3

7 years ago
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.

Comment 4

7 years ago
Looks like the code did this ever since Ben's first check in 6 years ago.
(Assignee)

Comment 5

7 years ago
Created attachment 519343 [details] [diff] [review]
fix in filefield
Attachment #515570 - Attachment is obsolete: true
Attachment #519343 - Flags: review?(neil)

Comment 6

7 years ago
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-
(Assignee)

Comment 7

7 years ago
Created attachment 519582 [details] [diff] [review]
using nsIFile.leafName
Attachment #519343 - Attachment is obsolete: true
Attachment #519582 - Flags: review?(neil)

Updated

7 years ago
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
You need to log in before you can comment on or make changes to this bug.