Closed Bug 199384 Opened 22 years ago Closed 22 years ago

UTF-8 filename is needed for mach-o fopen/PR_Open

Categories

(Core :: XPCOM, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: nhottanscp, Assigned: ccarlen)

References

Details

Attachments

(1 file)

This is separated from local mail folder bug 172472. For mach-o, fopen and PR_Open requires filename as UTF-8. Because this is mach-o specific the XP callers pass filename as platform charset. I heard that nsLocalFile for Mac also takes UTF-8 filename now. We can change the platform charset to be UTF-8 for MacOS X. In order to do that, nsIFileSpec need to change to take care UTF-8 filename.
nsbeta1 I think this is also "embed" but I do not have an actual example. Basically, wherever using fopen/PR_Open cannot open non-Ascii filenames in mach-o build. A known problem is that non-Ascii local mail folder cannot be created (bug 172472).
Keywords: nsbeta1
Summary: UTF-8 filename is needed for mach-o fopen/PR_Open → UTF-8 filename is needed for mach-o fopen/PR_Open
Blocks: 172472
I spend time debugging and found opening a file for nsIFileSpec is done by PR_Open for mach-o. Note that the code below is in #else part of #ifdef XP_MAC but XP_MAC is not defined for mach-o (very confusing). http://lxr.mozilla.org/seamonkey/source/xpcom/obsolete/nsIFileStream.cpp#284 284 // Platforms other than Macintosh... 285 // Another bug in NSPR: Mac PR_Open assumes a unix style path, but Win PR_Open assumes 286 // a windows path. 287 if ((mFileDesc = PR_Open((const char*)nsFileSpec(inFile), nsprMode, accessMode)) == 0) 288 return NS_FILE_RESULT(PR_GetError()); Anyway, at least open file for nsIFileSpec works with UTF-8 filename (need to confirm this with ccarlen), I think we can change the platform charset for mach-o to UTF-8.
Attachment #118709 - Flags: review?(ccarlen)
Comment on attachment 118709 [details] [diff] [review] Return UTF-8 as a platform file charset. r=ccarlen. The FS charset on Mach-O is either UTF-8 or UCS-2, depending on which APIs are used. Which code is creating nsFileSpecs with paths mapped by uconv? I think this is only a problem in that case. If using nsILocalFile, this shouldn't be a problem.
Attachment #118709 - Flags: review?(ccarlen) → review+
>Which code is creating nsFileSpecs with paths mapped by uconv? Some mail code like import use nsFileSpec, also several other places in mail/news. And mozilla/db/mork does not use xpcom/io but calls fopen directly.
Attachment #118709 - Flags: superreview?(darin)
reassign to nhotta
Comment on attachment 118709 [details] [diff] [review] Return UTF-8 as a platform file charset. sr=darin
Attachment #118709 - Flags: superreview?(darin) → superreview+
Attachment #118709 - Flags: approval1.4a?
Comment on attachment 118709 [details] [diff] [review] Return UTF-8 as a platform file charset. a=asa (on behalf of drivers) for checkin to 1.4a but this needs to land fast if it's gonna make it.
Attachment #118709 - Flags: approval1.4a? → approval1.4a+
checked in to the trunk
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Does this fix bug 194618, also?
*** Bug 200008 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: