X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-5.5 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Received: by 10.68.25.201 with SMTP id e9mr7578196pbg.145.1362798528848;        Fri, 08 Mar 2013 19:08:48 -0800 (PST)
Message-ID: <513AA7BD.2070503@gmail.com>
Date: Sat, 09 Mar 2013 11:08:45 +0800
From: Arthur Tu <arthur.jim.tu@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Drag a file into emacs-w32 frame
References: <5134CACE.9060900@gmail.com> <51351188.9010208@cornell.edu> <20130304213902.GH4078@calimero.vinschen.de> <513514EB.7050107@dancol.org> <513A1F10.1050906@cornell.edu>
In-Reply-To: <513A1F10.1050906@cornell.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

I want to help, but i have never read about the source code of emacs:-[

Maybe i can pick it up some time.

Hope this can be fixed soon.

On 3/9/2013 1:25 AM, Ken Brown wrote:
> On 3/4/2013 4:40 PM, Daniel Colascione wrote:
>> On 3/4/2013 1:39 PM, Corinna Vinschen wrote:
>>> On Mar  4 16:26, Ken Brown wrote:
>>>> On 3/4/2013 11:24 AM, Arthur Tu wrote:
>>>>> Today when i tried to drag a file whose name containing chinese
>>>>> characters into emacs, it failed to open.
>>>>>
>>>>> Here is the brief review:
>>>>>
>>>>> 1. a file with a pure english file name to emacs-32 frame:
>>>>>
>>>>>      open successfully.
>>>>>
>>>>>
>>>>> 2. a file with chinese characters in its name to emacs-32 frame:
>>>>>
>>>>>       error message: "dnd-open-local-file: Can not read
>>>>> file:/cygdrive/c/Users/Arthur/Desktop/%20%20%20%20.txt".
>>>>>      in fact, i tried several times with different name. the name was
>>>>> always decoded as a punch of "20%", even though different chinese
>>>>> characters were there.
>>>>>
>>>>>
>>>>> 3. the same file with chinese characters in its name to a emacs-nox
>>>>> frame(mintty):
>>>>>
>>>>>      the file name was pasted into the buffer correctly. chinese
>>>>> characters were shown correctly. the file wasn't open. (This is 
>>>>> what's
>>>>> expected to happen in terminal session.)
>>>>>
>>>>>
>>>>> So my question was around the situation 2.
>>>>> How did the emacs-w32 handle the dragged file?
>>>>
>>>> The code for handling the file name appears to be in src/w32fns.c.
>>>> I don't know what the issues are in trying to make it work when the
>>>> name contains Chinese characters.  Daniel?
>>>
>>> Cygwin is using UTF-8 as codeset by default.  Is it possible that
>>> w32fns.c is using *shudder* Windows functions to load the file?  If so,
>>> it uses the current Windows ANSI codepage, perhaps cp850 or some such.
>>>
>>> Bottom line: Use Windows functions for the GUI as much as you like.
>>> But don't use the Windows file API.  Use Cygwin functions for that.  If
>>> you have to use a Windows functions to fetch the filename, use the
>>> UNICODE Windows functions (the one with the trailing W) and convert the
>>> filename to the current Cygwin codeset using cygwin_conv_path
>>> (CCP_WIN_W_TO_POSIX, ...).
>>>
>>
>> God no --- we're not using Win32 filesystem API functions in cygw32 
>> Emacs. I
>> haven't had a chance to take a look at the problem yet, but it's 
>> probably just a
>> URI-encoding issue. Emacs insists on receiving drag-and-drop events 
>> as URIs,
>> even if they come in as filenames and pop back out the other end as 
>> filenames.
>
> I did some tests that suggest that the problem is not the URI 
> encoding.  I filed an emacs bug report with details:
>
>   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13907
>
> Let's followup there.
>
> Ken
>
>
> -- 
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

