On Wed, Dec 3, 2008 at 12:13 PM, Charles Campbell wrote:
>
> Yukihiro Nakadaira wrote:
>> This problem occurs when encoding=euc-jp.  See sepchr variable in
>> autoload/netrw.vim.  <char-0xff> is used for separate character.  But it
>> is not safe in euc-jp (and perhaps other multi-byte) encoding.
>>
>> To reproduce:
>>    set enc=euc-jp
>>    " separator, used in netrw
>>    let sepchr = "\<char-0xff>"
>>    " put file entry
>>    put='foo'
>>    " insert sort priority
>>    exe 's/^/001'.sepchr.'/'
>>    " remove it
>>    exe 's/^\d\{3}'.sepchr.'//e'
>>
>>
> Good catch -- I wasn't having much luck finding the problem (but then I
> don't use enc=euc-jp).
> I've put netrw v135f on my website
> (http://mysite.verizon.net/astronaut/vim/index.html#NETRW).
>
> * g:netrw_sepchr is now user-changeable (in his/her .vimrc).  I've set
> it by default to 0x01 for euc-jp,
>  but am awaiting comment from euc-jp users.  Any other encodings need
> to have the default changed?

Looking at the code, the way this is done seems fundamentally
broken... If I'm understanding things correctly, you're trying to
separate the priority from the filename with a "separator character",
and then using s/\d\{3}SEPCHR// to remove it later.  If I'm not
misunderstanding that, it seems that it would be completely impossible
to choose a separator character which is an invalid character in
filenames on all systems.  An ext2 filesystem could have a file named
"123\xFF" or "123\x01"; in fact the only two invalid characters on the
filesystem are NUL and forward slash, and neither of those are
suitable for what use here - vim strings can't contain a NUL byte, and
123/ is a valid name for a directory that you may need to sort.  I
suppose one work-around might be to substitute all \ for \\ and all /
for \/ and then use / as a separator character, replacing \\ with \
and \/ with / afterwards, but even that idea seems fragile.  Am I
completely off base?  Is the way it's currently being done safer than
it appears to me?

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to