Gvim 8.2 displays "Can't open file for writing" with a windows files that have a Unicode colon in the file name. Notepad, Wordpad, LibreOffice all work.
1 Answers
You mentioned in the comments, that the "unicode colon" is 0xFF1A.
According to codetable.net this is a
"Fullwidth Colon".
- ":" (Fullwidth Colon)
- ":" (normal colon)
I tested files with this character in its name on
- Vim on Linux -> OK
- Vim in Git Bash on Windows (MSYS2) -> OK
- Vim on Windows -> NOT OK
I only have a rather old 8.1.2188 available on Windows 10. On loading the file the Fullwidth Colon was replaced by a normal colon. So in fact Vim is not editing the file given as parameter (or selected via file dialog or opened via drag and drop).
So this is not the problem you see, but there is something wrong.
The problem in this case is, that the encoding of Vim internally is "latin1", a single-byte character set. So the file name is converted to latin1 and this results in replacing the Fullwidth Colon with a normal colon.
I changed the internal character set by adding
set encoding=utf-8
as the first line of my vimrc.
Just try this. After you restarted Vim you can execute
:set encoding?
to validate that the encoding is really "utf-8". If not, something is resetting
it -- maybe you have a superfluous set nocompatible.
With encoding set to utf-8 I can load and save the file containing the Fullwidth Colon in the name.
- 9,197
- 1
- 11
- 30
-
Oh I see. I think, the default encoding setting for Windows should in my opinion always be UTF-8, but IIRC, Bram doesn't want to change this for backwards compatible reasons. – Christian Brabandt Sep 30 '20 at 07:38
:in the file name. – Herb Sep 28 '20 at 19:19"%p. This will paste the file name. Move the cursor to the problematic character and hitga. This will display the character information. Update your question with that information. – Ralf Sep 29 '20 at 07:29Thanks, jerryd
– JerryD Sep 29 '20 at 22:07