Closed Bug 31246 Opened 25 years ago Closed 25 years ago

File Open dialog title is corrupted if the tiltle is non-ASCII

Categories

(Core :: Internationalization, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED WONTFIX

People

(Reporter: rchen, Assigned: law)

References

Details

(Whiteboard: [nsbeta2+])

With browser, go to 'File' menu, then 'Open File' command and look at 'Open File' on the title bar of the dialog box, Japanese is corrupted. The data file is navigator.properties with the data: openFile=\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f
cc msanz, bobj.
Are you testing on a Japanese machine ?
Status: NEW → ASSIGNED
YES. JA NT 4.0
Blocks: 12394
Can we have the fix for beta1?
In the dialog itself, do you see the file name correctly? Is it just in the title of the dialog window where it is displayed wrong?
The title of the dialog is "File Open" which is corrupted if we localize it.
The problem is in NS_IMETHODIMP nsFileSpecWithUIImpl::ChooseFile(const char *title, char **_retval) This interface expect const char* title, but it could receive non ASCII data. Please change this to PRUnichar* , also NS_IMETHODIMP nsFileSpecWithUIImpl::ChooseInputFile( const char *inTitle, PRUint32 inMask, const char *inExtraFilterTitle, const char *inExtraFilter) so we won't lost data. and in mozilla/widget/public/nsIFileSpecWithUI.idl the interface should use wstring instead of string for title and OTHER text which may include human languages. reassign to law since he show in cvsblame of the idl . cc jefft since cvsblame show him on the .cpp The XPConnect automatically drop the higher byte of the unicode when it try to convert to char* from string, you should change the idl to wstring and the cpp to PRUnichar* and it should work . Reassign to who show in the cvsblame.
Assignee: ftang → law
Status: ASSIGNED → NEW
Blocks: 31752
It seems you also need to change all the places which call it. ChooseInputFile Defined as a function in: widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp, line 237, as member of class nsFileSpecWithUIImpl Referenced (in 4 files total) in: extensions/psm-glue/src/nsPSMUICallbacks.cpp: View change log or Blame annotations line 126 netwerk/security/psm/nsPSMUICallbacks.cpp: View change log or Blame annotations line 124 widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp: View change log or Blame annotations line 145 line 237 mailnews/addrbook/src/nsAddressBook.cpp: View change log or Blame annotations line 1260 ChooseFile Defined as a function in: widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp, line 143, as member of class nsFileSpecWithUIImpl Referenced (in 1 files total) in: widget/src/xpwidgets/nsFileSpecWithUIImpl.cpp: View change log or Blame annotations line 143
Blocks: 31288
Status: NEW → ASSIGNED
Thanks for the excellent instructions in your comments, Frank. I have a question, still. Regarding the file names accepted/returned by some nsIFileSpecWithUI methods: Are those acceptable as "char *"? I seem to recall that all file names can be converted to UTF-8 (but I'm not an expert and that might not apply on all platforms). I need to know whether to change *all* the strings to wstrings, or just some/most of them. Thanks again.
Target Milestone: M15
Whenever you need to convert a file name from PRUnichar to char*, you should convert it to the "file system charset" . You can find out the file system charset by calling the nsIPlatformCharset service. You should get a nsIUnicodeEncoder/nsIUnicodeDecoder to convert between PRUnichar* and char* in the "file system charset" by passing that file system charset to nsICharacterConverterManager::GetUnicodeDecoder/Encoder.
Blocks: 14744
Move to M16 for now ...
Target Milestone: M15 → M16
Keywords: nsbeta2
Depends on: 33812
No longer depends on: 33812
Blocks: 33812
Putting on [nsbeta2-] radar. Not critical to beta2.
Whiteboard: [nsbeta2-]
removing nsbeta2-, localizability bugs need to be fixed in beta2. Bob, can you propose a fix for this bug and help law?
Whiteboard: [nsbeta2-]
ftang has already provide a lot of pointers. Bill (law), Do you need more details?
No, I think this is under control, except for getting around to applying the fix. Priority is on beta2 features so bugs are being put off for a bit longer.
Target Milestone: M16 → M18
Putting on [nsbeta2+] radar for beta2 fix.
Whiteboard: [nsbeta2+]
Resolving this WONTFIX since nsIFileSpecWithUI is no longer used (at least by any code I'm aware of). If we find code that uses that interface, a bug should be opened against that code to have it changed. Somebody might also want to check that a non-ASCII title actually works with nsIFilePicker (but I think it does).
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → WONTFIX
Verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.