Closed Bug 194067 Opened 23 years ago Closed 20 years ago

support unicode file name on drag and drop(D&D)

Categories

(Core :: Internationalization, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kaleida, Assigned: emk)

References

Details

(Keywords: intl)

Attachments

(1 file, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 When you drag and drop onto Mozilla URLs/Internet Shortcuts (created using Internet Explorer 6.0) that contain any foreign characters in the title, Mozilla refuses to open them. Reproducible: Always Steps to Reproduce: 1. Open the following Web page: http://www.linux.ru using Internet Explorer 6.0 and add this Web page to Favorites. 2. Drag and drop this new Favorite/Internet Shortcut onto Mozilla 1.2.1 3. The following error message will be displayed: “Alert The file /C:/Documents and Settings/user/Favorites/Linux.?? ? ????????? ?? ??????? - ?????? Linux.url cannot be found. Please check the location and try again. OK” Actual Results: The following error message will be displayed: “Alert The file /C:/Documents and Settings/user/Favorites/Linux.?? ? ????????? ?? ??????? - ?????? Linux.url cannot be found. Please check the location and try again. OK” Expected Results: Mozilla should have opened the specified Web page, since the URL was valid. (It does work in Internet Explorer 6.0).
ok, this happens in 2/10-08 I tested with にほん.url and בּת.url both fail.
Assignee: asa → neeti
Component: Browser-General → XPCOM
QA Contact: asa → scc
Blocks: 120814
How is this different from bug 185818?
Status: UNCONFIRMED → NEW
Ever confirmed: true
*** Bug 185818 has been marked as a duplicate of this bug. ***
changing component to Intl
Component: XPCOM → Internationalization
QA Contact: scc → ylong
Yuying, do you see this problem with the latest trunk builds? Thanks.
I saw this on 04-09 trunk build / WinXP-JA: Some unicode characters titled pages (e.g. Chinese or Korean on Japanese system) has this problem. But no problem with Japanese or French titled pages.
> Some unicode characters titled pages (e.g. Chinese or Korean on > Japanese system) has this problem. But no problem with Japanese or > French titled pages. Correction: the problem happens on all non-native non-ascii charaters.
This bug still has not been fixed, even in Mozilla 1.4 for Windows. I am using Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624
There's a fix for this(see bug 162361), but that has been put on hold because we haven't yet decided what to do with NSPR file IO APIs (necessary to fix this)
Depends on: 162361
Keywords: intl
This bug is still present in Mozilla 1.5.
This should be fixed on the (firefox) trunk build thanks to my check-in of the patch for bug 162361. Anybody would be welcome to test it and verify it as fixed if it's indeed fixed.
Unfortunately we can't still open dropped Internet Shortcuts with Unicode name after bug 162361 and bug 278161 are fixed. We will have to handle CFSTR_SHELLIDLIST per masayuki.
(In reply to comment #12) > Unfortunately we can't still open dropped Internet Shortcuts with Unicode name > after bug 162361 and bug 278161 are fixed. > We will have to handle CFSTR_SHELLIDLIST per masayuki. You're right. I mixed up this issue with importing MS IE favorites.
Yeah, I have a patch for supporting the Unicode on D&D. But the patch is not completed. I'll create the patch after return to Japan.
Assignee: neeti → masayuki
Summary: Mozilla cannot open Favorites containing foreign (Unicode) characters that were created Internet Explorer 6.0. → support unicode file name on drag and drop(D&D)
Blocks: 332110
Blocks: 332137
Attached patch Patch rv 1.0 (obsolete) — Splinter Review
I have a much simpler idea. We can simply replace ::DragQueryFileA with ::DragQueryFileW because we dropped support for Win9x.
Assignee: masayuki → VYV03354
Status: NEW → ASSIGNED
Attachment #217662 - Flags: review?(emaijala)
Comment on attachment 217662 [details] [diff] [review] Patch rv 1.0 I'd like to use this chance to make the code more readable using some nice string stuff we have. I know there is old code like that, but could you use nsString and its friends (beginWriting, ToNewUnicode)? + PRUint32 len = nsCRT::strlen(inFileName); + if ( (len > 4) && nsCRT::IsAscii(&inFileName[len - 4]) + && ((char)inFileName[len - 4] == '.') + && (nsCRT::ToLower((char)inFileName[len - 3]) == 'u') + && (nsCRT::ToLower((char)inFileName[len - 2]) == 'r') + && (nsCRT::ToLower((char)inFileName[len - 1]) == 'l') ) This would be much nicer with StringEndsWith using nsCaseInsensitiveStringComparator. + *aLen = fileNameLen * 2; Use sizeof(PRUnichar) instead of 2. It's much more indicative on what the meaning is (and future proof). - nsMemory::Free ( NS_REINTERPRET_CAST(char*, data) ); + nsMemory::Free ( NS_REINTERPRET_CAST(char*, data) ); Data would be PRUnichar, no? But do you actually need the cast at all? + PRUnichar* dest = NS_REINTERPRET_CAST(PRUnichar*, pDropFile + 1); |pDropFile + 1| should be |pDropFile + pDropFile->pFiles|. + const PRUnichar* source = pFileName; + memcpy(dest, source, (allocLen - 1) * 2); // copies the null character in pFileName as well Variable "source" is unnecessary.
Attachment #217662 - Flags: review?(emaijala) → review-
Attached patch Patch rv 1.1 (obsolete) — Splinter Review
Sorry, I tried to replace |PRUnichar*| with |nsString|, but I don't understand where to use beginWriting or ToNewUnicode. > |pDropFile + 1| should be |pDropFile + pDropFile->pFiles|. Due to magical C pointer arithematic, |pDropFile + 1| will add |sizeof(DROPFILES)| to the internal pointer value. And |pDropFile->pFiles| is always set to |sizeof(DROPFILES)|. If it's preferable to type |pDropFile->pFiles| explicitly, it should be like: PRUnichar* dest = NS_REINTERPRET_CAST(PRUnichar*, NS_REINTERPRET_CAST(char*, pDropFile) + pDropFile->pFiles); I think it's too lengthy. Other nits are resolved.
Attachment #217662 - Attachment is obsolete: true
Attachment #217736 - Flags: review?(emaijala)
(In reply to comment #17) > Due to magical C pointer arithematic, |pDropFile + 1| will add > |sizeof(DROPFILES)| to the internal pointer value. And |pDropFile->pFiles| is > always set to |sizeof(DROPFILES)|. > If it's preferable to type |pDropFile->pFiles| explicitly, it should be like: > PRUnichar* dest = NS_REINTERPRET_CAST(PRUnichar*, NS_REINTERPRET_CAST(char*, > pDropFile) + pDropFile->pFiles); > I think it's too lengthy. Right, but I prefer the lengthy way for readability and safety (what if somethign changes and pDropFiles isn't sizeof(DRPOFILES) anymore?).
Attached patch Patch rv 1.2Splinter Review
Attachment #217736 - Attachment is obsolete: true
Attachment #218604 - Flags: review?(emaijala)
Attachment #217736 - Flags: review?(emaijala)
Ere: Could you review the patch? I changed your point in comment #18. Do I need also using new string API? Honestly, I have no idea how to rewrite the code.
Comment on attachment 218604 [details] [diff] [review] Patch rv 1.2 It's fine for me.
Attachment #218604 - Flags: review?(emaijala) → review+
Comment on attachment 218604 [details] [diff] [review] Patch rv 1.2 Requesting sr.
Attachment #218604 - Flags: superreview?(roc)
Comment on attachment 218604 [details] [diff] [review] Patch rv 1.2 + PRUnichar* dest = NS_REINTERPRET_CAST(PRUnichar*, NS_REINTERPRET_CAST(char*, pDropFile) + pDropFile->pFiles); I agree with Masatoshi and would just go with pDropFile + 1, but this is OK.
Attachment #218604 - Flags: superreview?(roc) → superreview+
checked-in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Masayuki, I think we still need a patch for the branch (that should work on Win9x/ME. Of course, on Win 9x/ME, non-system-codepage char. wouldn't be supported). Can you do that (perhaps in a separate bug filed specifically for 1.8 branch) as you indicated in comment #14?
(In reply to comment #25) > Masayuki, I think we still need a patch for the branch (that should work on > Win9x/ME. Of course, on Win 9x/ME, non-system-codepage char. wouldn't be > supported). Can you do that (perhaps in a separate bug filed specifically for > 1.8 branch) as you indicated in comment #14? > I file a new bug that is bug 336225. I'll work on that ASAP. # Kimura-san: # If you want to work on that, please take it :-)
(In reply to comment #26) > # Kimura-san: > # If you want to work on that, please take it :-) OK, I'll take it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: