Can not open filenames with non-ascii characters on Windows

144 views
Skip to first unread message

David Balažic

unread,
Mar 19, 2014, 10:45:22 AM3/19/14
to vim...@googlegroups.com
Hi!

I used vim 7.3 and from today 7.4 on Windows 7 Pro SP1 64 bit.

It seems it has problems opening files that have non-ascii characters in their names.

For example:
- I create file named testčšž.txt (in case this gets corrupted, that is testcsz.txt with caron on the c, s and z)
- in Windows Explorer I right click the file and choose "Edit with Vim"

Expected: the file is opened in GVIM

Actual:
- a new file is created/opened in GVIM
The GVIM window title says testcšž.txt for filename (the č lost the caron),
also the bottom of the window says:
"C:\path\testcXX.txt" [New File]

X are black squares

So:
- the 'č' gets converted to 'c'
- 'šž' is displayed correctly in windows title, but in the status line

I put a screenshot here: http://imgur.com/NNtUuxl

If I save this file, a file named "testcšž.txt" is created.


It is also the same if I drag'n drop the file into a running GVIM window.

Is this a known issue or some misconfiguration?

Regards,
David Balažic

jk12...@gmail.com

unread,
Mar 19, 2014, 2:47:38 PM3/19/14
to vim...@googlegroups.com
I would boot up the computer with a Linux disk and use linux to change the filenames.
 
Gerald Klein DBA
Cont...@geraldklein.com
www.geraldklein.com
geraldklein.wordpress.com
j...@zognet.com
708-599-0352

Arch/Gentoo Awesome, Ranger & Vim the coding triple threat.
Linux registered user #548580
 
--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yukihiro Nakadaira

unread,
Mar 22, 2014, 11:57:29 AM3/22/14
to vim...@googlegroups.com
I think you need to use unicode.
Try ":set encoding=utf-8" and ":edit testčšž.txt".
Maybe you also need to change font. ":set guifont=*".

--
Yukihiro Nakadaira - yukihiro....@gmail.com

Tim Chase

unread,
Mar 22, 2014, 12:08:44 PM3/22/14
to vim...@googlegroups.com, xer...@gmail.com
On 2014-03-19 07:45, David Balažic wrote:
> I used vim 7.3 and from today 7.4 on Windows 7 Pro SP1 64 bit.
>
> It seems it has problems opening files that have non-ascii
> characters in their names.
>
> For example:
> - I create file named testčšž.txt (in case this gets corrupted,
> that is testcsz.txt with caron on the c, s and z)
> - in Windows Explorer I right click the file and choose "Edit with
> Vim"
>
> Expected: the file is opened in GVIM
>
> Actual:
> - a new file is created/opened in GVIM
> The GVIM window title says testcšž.txt for filename (the č lost the
> caron), also the bottom of the window says:
> "C:\path\testcXX.txt" [New File]
>
> X are black squares

The black squares might just be font issues. As Yukihiro mentions,
check your 'guifont' setting and try a different font, or check your
encoding.

If it's not even able to find the file and open it correctly, another
possibility would be to use tab-expansion to let Vim populate the
filename with what it thinks the filename should be:

:e testc

and then hit <tab> once (or more, if you have multiple "testc*.txt"
files) to let Vim populate the filename with what it interprets.

-tim


David Balažic

unread,
Mar 22, 2014, 3:30:32 PM3/22/14
to Tim Chase, vim...@googlegroups.com
:e test+TAB does not work.

TAB does not make anything appear.

It works with "normal" filenames.

I suspect Vim uses the 8-bit (ASCII) API instead of the (20 years
old!) Unicode API.
In that case of course it can not work.

Regards,
David

David Balažic

unread,
Mar 22, 2014, 3:42:10 PM3/22/14
to vim...@googlegroups.com
On 22 March 2014 16:57, Yukihiro Nakadaira <yukihiro....@gmail.com> wrote:
> On Wed, Mar 19, 2014 at 11:45 PM, David Balažic <xer...@gmail.com> wrote:
>>
> Try ":set encoding=utf-8" and ":edit testčšž.txt".

Yes, this helped.
After setting the encoding, the file can be opened.
Note that the file content is pure ASCII, just the filename has
non-ASCII characters.

Regards,
David
Reply all
Reply to author
Forward
0 new messages