You are not logged in.

#1 2020-07-07 20:18:45

ltsdw
Member
Registered: 2020-04-20
Posts: 73

[Solved] Problems with encoding and vim acting weird

Vim version:

12067.7147820cb-1

some envars:

LANG=pt_BR.UTF-8
LANGUAGE=en_US
LC_ALL=C

I have the set encoding=utf-8 and set fileencoding=utf-8 on .vimrc, and it works as expected, atleast until I close the file and open it again.

Here I'm editing a file and it's all ok:

normal

And here I opened the file again:

notnormal

Sometimes depending on the characters that I had typed in the file, and pressing move keys in vim will delete part of the text and enter in the insert mode.

Last edited by ltsdw (2020-10-06 01:00:28)

Offline

#2 2020-07-07 20:44:43

seth
Member
Registered: 2012-09-03
Posts: 51,357

Re: [Solved] Problems with encoding and vim acting weird

The file is utf-8 but your terminal (or at least vim) is not.
The reason would be "LC_ALL=C" which will set all locales to "C", ie. ascii.

In doubt:

localectl
locale
locale -a

Offline

#3 2020-07-07 21:03:34

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

seth wrote:

The reason would be "LC_ALL=C" which will set all locales to "C", ie. ascii.

So, I've unsetted that, re-run locale-gen just to certify (rebooted the system), and still getting the same behavior.

seth wrote:

In doubt:

localectl
locale
locale -a

$ localectl:

   System Locale: LANG=pt_BR.UTF-8
                  LANGUAGE=en_US
       VC Keymap: br-abnt2
      X11 Layout: n/a

$ locale:

LANG=pt_BR.UTF-8
LC_CTYPE="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"
LC_ALL=

$ locale -a:

C
ja_JP.utf8
POSIX
pt_BR
pt_BR.iso88591
pt_BR.utf8

Last edited by ltsdw (2020-07-07 21:04:50)

Offline

#4 2020-07-07 21:31:43

loqs
Member
Registered: 2014-03-06
Posts: 17,386

Re: [Solved] Problems with encoding and vim acting weird

LANGUAGE=en_US

No en_US locale is installed and no other entry is listed but the entry does not match:

LANG=pt_BR.UTF-8

What is this trying to achieve?

Offline

#5 2020-07-07 21:49:01

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

loqs wrote:
LANGUAGE=en_US

No en_US locale is installed and no other entry is listed but the entry does not match:

LANG=pt_BR.UTF-8

What is this trying to achieve?

I just like my system/environment in english, as it's not my native language, I like to be exposed to the language as often as possible, and with that the rest is in pt_BR as I need write things here and there in portuguese (without it I wouldn't be able to type 'ç', '~' or see some characters).

Offline

#6 2020-07-07 21:50:07

seth
Member
Registered: 2012-09-03
Posts: 51,357

Re: [Solved] Problems with encoding and vim acting weird

Offline

#7 2020-07-07 22:00:19

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

Yes, when I first installed the system, back in there I wasn't able to type 'ç', '~' when uncommenting en_US.UTF-8 UTF-8 and setting LANG=en_US.UTF-8, and since then I've been using LANG=pt_BR.UTF-8. Maybe I misread something?

Offline

#8 2020-07-07 22:26:19

seth
Member
Registered: 2012-09-03
Posts: 51,357

Re: [Solved] Problems with encoding and vim acting weird

What does "LANGUAGE" do, what is it use for?

when uncommenting en_US.UTF-8 UTF-8

en_US.UTF-8 is not an available locale.

Offline

#9 2020-07-07 22:44:22

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

seth wrote:

What does "LANGUAGE" do, what is it use for?

According to the wiki, 'Programs which use gettext for translations respect the LANGUAGE option in addition to the usual variables.', as that I can get manuals, and other things in english. As I said above, I like immersion as much as possible.

seth wrote:

when uncommenting en_US.UTF-8 UTF-8

en_US.UTF-8 is not an available locale.

Sorry, indeed I dind't explained it right, should be uncommenting en_US.UTF-8 UTF-8 at /etc/locale.gen, to use LANG=en_US.UTF-8.

Last edited by ltsdw (2020-07-08 18:23:16)

Offline

#10 2020-07-07 22:51:16

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

And back in that time I discovered that wasn't needed the use of LANG=en_US.UTF-8 to get my entire environment in english, just LANGUAGE, and then I decided that was safe set LANG to pt_BR.UTF-8 (as I need this in pt_BR.UTF-8 to get the right behavior while typing or to get the right character displayed on terminal). Also according to the wiki the wiki for LANG: 'The locale set for this variable will be used for all the LC_* variables that are not explicitly set.', LANG will not apply for others LC_ that I did explicitly setted.

Last edited by ltsdw (2020-07-08 18:23:45)

Offline

#11 2020-07-07 23:01:18

seth
Member
Registered: 2012-09-03
Posts: 51,357

Re: [Solved] Problems with encoding and vim acting weird

You're getting the entire environment in C, not "english". en_US is not C and most importantly the latter is not UTF-8
vim itself does not seem to interpret the variable, but your VTE might

Sidenote: "second" does not mean what you probably think it means.

Offline

#12 2020-07-07 23:03:18

loqs
Member
Registered: 2014-03-06
Posts: 17,386

Re: [Solved] Problems with encoding and vim acting weird

Programs that do not use gettext would use pt_BR.UTF-8 as specified by LANG,  programs that respect LANGUAGE fail to use en_US as it is not available:

C
ja_JP.utf8
POSIX
pt_BR
pt_BR.iso88591
pt_BR.utf8

Offline

#13 2020-07-07 23:32:04

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

seth wrote:

You're getting the entire environment in C, not "english". en_US is not C and most importantly the latter is not UTF-8
vim itself does not seem to interpret the variable, but your VTE might

Hmmmmm... ok, so what should be the approach as I already unssetted LC_ALL, and still not seeing the right behavior.

seth wrote:

Sidenote: "second" does not mean what you probably think it means.

Really? HAHAHAHAH now I'm ashamed of myself lol Always thought that I could use that to mention/quote something that someone/something says. Damn you all false friends. I think I should been using 'according to'.
Noted, thank you.

Offline

#14 2020-07-07 23:35:18

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

loqs wrote:

Programs that do not use gettext would use pt_BR.UTF-8 as specified by LANG,  programs that respect LANGUAGE fail to use en_US as it is not available:

C
ja_JP.utf8
POSIX
pt_BR
pt_BR.iso88591
pt_BR.utf8

Right, will try uncommenting en_US then and re-running lolace-gen (even though everything was working right, except by the vim itself).

Offline

#15 2020-07-07 23:42:33

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

$ locale -a:

C
en_US
en_US.iso88591
en_US.utf8
ja_JP.utf8
POSIX
pt_BR
pt_BR.iso88591
pt_BR.utf8

Same behavior.
But I noted something, maybe it wasn't related with my envars at all. Maybe, it's my terminal... (st) when I open a new terminal or when go fullscreen, everything displays correct.

Offline

#16 2020-07-07 23:47:37

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

here with the problem:
https://i.paste.pics/95194da1827dcd3adf … edd406.png

and then:
https://i.paste.pics/fe069ca537660167ef … 11e4d3.png

Do we have a [spoiler][/spoiler] tag or something? Didn't saw nothing related over here https://bbs.archlinux.org/help.php#url

Last edited by ltsdw (2020-07-07 23:58:38)

Offline

#17 2020-07-07 23:53:53

seth
Member
Registered: 2012-09-03
Posts: 51,357

Re: [Solved] Problems with encoding and vim acting weird

Please replace the oversized images w/ thumbnails and/or links, remove the en_US and en_US.iso88591 locales and mention what VTE you use.

Offline

#18 2020-07-08 00:03:05

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

seth wrote:

Please replace the oversized images w/ thumbnails and/or links, remove the en_US and en_US.iso88591 locales and mention what VTE you use.

I don't know how to use thumbnails, I'll go with links then. And VTE, st (suckless terminal).

Last edited by ltsdw (2020-07-08 18:24:57)

Offline

#19 2020-10-06 00:59:59

ltsdw
Member
Registered: 2020-04-20
Posts: 73

Re: [Solved] Problems with encoding and vim acting weird

Well, installed nvim recently and everything is working just fine, so... closing.

Offline

Board footer

Powered by FluxBB