Hello.

I'm using Vim with encoding=utf8 and termencoding=euc-jp currently.
But I cannot open a file that has a EUC-JP encoded filename by using :e.

Then I realized that Vim should have an option to specify filename encoding.
What do you think about this?


I attached a quick hacky patch that adds 'systemencoding' option to
specify filename encoding on a filesystem.

The option is also used to filter some commands before passing to a shell,
so that ":!echo '(mbyte words)' > (mbyte filename).txt" works correctly.

This is just a PoC code. All I need is natural unconscious filename handling.

Current implementation of the patch adds a thin layer to convert filenames
between 'encoding' and 'systemencoding'.
And internally hold all filenames in converted 'encoding' form, instead of
raw filenames.

I thought this was a bad idea because it loose original information,
but it was easy to implement.

So this patch cause some problems, for example:
* When you change 'systemencoding' on runtime, you will get trouble with
 swap files.
* When you pass an invalid (for 'systemencoding') sequence of bytes as
 filename, you will get some unexpected result, because of filename
 conversion failed.

Maybe, we should add a new field for multibyte filenames for user in buf_T,
and keep original filenames untouched for actual read and write.
# but I think this will be hard to implement.

I have no idea which is the best way, so I made this patch to see what happen.

I repeat this is just a PoC code.
The patch is not tested enough yet, and it may be wrong.
Moreover, I'm not using gvim nor Windows. I tested only on FreeBSD.
And I'm not good at Vim source code, so I hope someone fix it.

Best regards,
Kikuchan

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Attachment: vim-systemencoding.patch
Description: vim-systemencoding.patch

Raspunde prin e-mail lui