neovim
neovim copied to clipboard
pu=strftime "en août" breaks fileencoding
Problem
In August, on a French system, in a utf-8 file, :pu=strftime('%B') puts ao<fb>t where that <fb> is some kind of holding character. Saving and reloading the file then switches it to fileencoding=latin1, and un-undoably replaces existing utf-8 glyphs with multi-character latin1 encodings.
Steps to reproduce
nvim --clean empty_utf8_file :se fenc=utf8 :pu=strftime('%B') :w :e :se fenc
Expected behavior
In August in France, :pu=strftime('%B') should :put "août" with no consequent switching of fileencoding to latin1.
Neovim version (nvim -v)
NVIM v0.10.1
Vim (not Nvim) behaves the same?
no, vim 9.1
Operating system/version
Windows 10 Pro
Terminal name/version
Windows Terminal v1.20.11781.0
$TERM environment variable
not applicable
Installation
winget add Neovim.Neovim
what is your exact locale?
:language
Current language: "LC_COLLATE=fr_FR;LC_CTYPE=fr_FR;LC_MONETARY=fr_FR;LC_NUMERIC=C;LC_TIME=fr_FR"
Windows 10 Pro > Paramètres > Heure et langue >
Region > France
Langue > Français (France)
Yeah, those are invalid. You must add the encoding, so fr_FR.UTF-8.
Okay, for comparison I happen to be typing this on my (Arch) Linux desktop that I run in UK English:
$ cat /etc/locale.conf
LANG=en_GB.UTF-8
:language
Current language: "LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=en_GB.UTF-8;LC_ADDRESS=en_GB.UTF-8;LC_TELEPHONE=en_GB.UTF-8;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=en_GB.UTF-8"
- which, including the .UTF-8 extension, would meet your criterion of "correct", but that's on a Linux system.
What I'm reporting is an apparent failure of Neovim, which defaults to UTF-8 (:h enc), to "correctly" use strftime in a Windows 10 Pro OS (Unicode in Microsoft Windows) set to French.
So I tried to incorporate your suggestion anyway on my French laptop:
PS> nvim --clean
:echo $LANG " returns nothing
:let $LANG = 'fr_FR.UTF-8'
:echo $LANG " returns "fr_FR.UTF-8"
:e try_again
:pu=strftime('%B') " still incorrectly puts "ao<fb>t" instead of "août"