[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] svn_cmdline__edit_file_externally() may not be able to open the target file in locale other than UTF-8

From: Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
Date: Mon, 21 Sep 2020 01:18:54 +0900

On 2020/09/20 23:53, Yasuhito FUTATSUKI wrote:
> On 2020/09/20 23:41, Stefan Sperling wrote:
>> On Sun, Sep 20, 2020 at 11:06:21PM +0900, Yasuhito FUTATSUKI wrote:
>>> On 2020/09/19 5:26, Yasuhito FUTATSUKI wrote:

>> It looks like apr_escape_shell() will escape 0x5c (backslash, \) when
>> looking for ASCII character bytes. When 0x5c is escaped this breaks the
>> SJIS-encoded byte sequence.
>
> Yes, it is right.
>
>> Have you already tried always using escape_path() on the UTF-8 version of
>> the string, and then converting the escaped path to the locale's encoding?
>> In other words: First use escape_path, then use svn_path_cstring_from_utf8?
>> Perhaps that will make SJIS work?
>
> Ah, I didn't make sense. I'll try and then post a new patch.
> Thank you very much!

I've tried and it works on SJIS environment. Thanks.

I attached an updated patch. (fix-edit-file-externally-patch-v2.txt)
[[[
Fix file name to edit from utf8 to local style.

* subversion/libsvn_subr/cmdline.c (svn_cmdline__edit_file_externally):
  Apply svn_path_cstring_from_utf8() to target file name after escape_shell().

Suggested by: stsp (applying order of file name conversion)
]]]

Parhaps even with this patch, it may not work on Windows system other than
UTF-8 code page, because svn_path_cstring_from_utf8() returns just same
string as input and system() will interpret with system active code page.
(I don't know Windows so much, so I leave it.)

Cheers,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>

Received on 2020-09-20 18:20:22 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.