Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Keyboard oddities and UTF-8.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Mon Feb 14, 2011 5:02 pm    Post subject: [SOLVED] Keyboard oddities and UTF-8. Reply with quote

Ladies and gentlemen, I think I've done something wrong when was trying to set UTF-8 support in my system.

My first language is Portuguese (Brazilian) but I live in a country where people speak Spanish (Uruguay), so the point is that I have a Spanish (Spain) keyboard and all the programs in Portuguese. I'm using Spanish (Spain) layout because in this one there's the "ç" key, so things is more easier.

Well, the problem is that after following Gentoo guide instructions to set UTF-8, the keyboard got crazy. The most annoying thing is the AltGr key that don't work any more. This means I can't type #, @, etc... This is the guide I followed [1] and I've checked it twice.

When the system is booting up I see this message:

Code:
sh: warning: setlocale: LC_ALL: cannot change locale (pt_BR.UTF-8)


This is what I have in /etc/env.d/02locale file:
Code:

LC_LANG="pt_BR.UTF-8"
LC_ALL="pt_BR.UTF-8"


If I delete LC_LANG or LC_ALL the symptoms are the same I described before.

Any help?

Greetings
_________________
64 Bits, good good!


Last edited by cibonato on Fri Feb 18, 2011 12:14 am; edited 2 times in total
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Mon Feb 14, 2011 5:43 pm    Post subject: Reply with quote

Minor things: it's just LANG, not LC_LANG and it should be enough, no need for LC_ALL.
Are you sure that locale exist for you ? Perhaps when you limited the number of generated locales, you've made a typo.

Does the keyboard problem regard console or X ?
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Mon Feb 14, 2011 8:58 pm    Post subject: Reply with quote

Well, first of all I have to apologize myself for an inaccuracy: there's no LC_LANG variable, it was a mistake. It's just LANG.

Yes, I'm sure there is pt_BR.UTF-8 locale. Initially this system was running pt_BR.ISO-8859-1 and I decided to change it to pt_BR.UTF-8. If I am not wrong. there should be few relation between the keyboard map and the locale. Off course, if the locale do not support Euro sign, so I should not expect it to be available.

The time I double checked [1] I was sure there's no typo. And last, the problem is just related with X (xorg). In console it is OK.

Greetings.

[1] - http://www.gentoo.org/doc/en/utf-8.xml
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Mon Feb 14, 2011 9:10 pm    Post subject: Reply with quote

Well, the console vs X part you should have mentioned right from the start.
It's probably incorrect settings in your xorg.conf (or one of *.conf snippets).

Let's take it slowly: what does 'locale' print in a terminal ?

A minor note though: parts of that guide are ridiculously outdated.
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Tue Feb 15, 2011 1:00 am    Post subject: Reply with quote

This is what I get when I type locale on console:

Code:
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=pt_BR.UTF-8


This is what I get when I type locale on gnome-terminal:

Code:
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=pt_BR.UTF-8


It's the same thing, is not it?

This the keyboard configuration for Xorg:

Code:

Section "InputDevice"
    Identifier     "Keyboard1"
    Driver         "kbd"
    Option         "AutoRepeat" "500 30"
    Option         "XkbRules" "evdev"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "es"
EndSection


By the way, I don't know if it could help or not, but I put it here for completeness. When I launch vim and try to insert something, at the bottom I should read "INSERÇÃO" (it means insert in Portuguese), but instead of it I read "INSER??O". "??" stands for some weird characters.

Maybe it's related with some fonts issue. Maybe not.

Greetings and thank you very much.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Feb 15, 2011 3:06 am    Post subject: Reply with quote

If locale doesn't print any warnings on its own, either you need to check /etc/env.d for old entries or search root's environment files - it's a bit strange the warning happens on boot only.

In any recent xorg-server with standard setting, such xorg.conf block gets effectively ignored.
In effect, your keyboard layout doesn't get set.
Pastebin your xorg.conf, if you can't figure it out with just all of the relevant forum threads and xorg-server upgrade guides.

Check if 'locale charmap' does return 'UTF-8'.

Was that part on vim about console or X ? Does "??" in that specific case stand for two characters or more ?
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Tue Feb 15, 2011 8:09 am    Post subject: Reply with quote

Did you make sure that pt_BR.UTF-8 is really created? Try 'locale -a' in terminal and see if this locale is available in the list.

Also, have you tried to use?

Option "XkbOptions" "compose:ralt"


Last edited by v_andal on Tue Feb 15, 2011 9:33 am; edited 1 time in total
Back to top
View user's profile Send private message
s_bernstein
Apprentice
Apprentice


Joined: 11 Mar 2006
Posts: 172
Location: Bremen, Germany

PostPosted: Tue Feb 15, 2011 9:00 am    Post subject: Reply with quote

Call genlocale to regenerate all your locales
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Tue Feb 15, 2011 10:39 am    Post subject: Reply with quote

VoidMage wrote:
If locale doesn't print any warnings on its own, either you need to check /etc/env.d for old entries or search root's environment files - it's a bit strange the warning happens on boot only.

In any recent xorg-server with standard setting, such xorg.conf block gets effectively ignored.
In effect, your keyboard layout doesn't get set.
Pastebin your xorg.conf, if you can't figure it out with just all of the relevant forum threads and xorg-server upgrade guides.

Check if 'locale charmap' does return 'UTF-8'.

Was that part on vim about console or X ? Does "??" in that specific case stand for two characters or more ?


That part on vim is about console and X. In both cases it shows me the same result (what drives me crazy because it seems LC_* variables is set correctly). locale charmap does return UTF-8 indeed. Lest's see if I can find something old in /etc/etc.d. I'll tell you if there's some news.

v_andal wrote:
Did you make sure that pt_BR.UTF-8 is really created? Try 'locale -a' in terminal and see if this locale is available in the list.

Also, have you tried to use?

Option "XkbOptions" "compose:ralt"


The locale pt_BR.UTF-8 is indeed created; this what locale -a gives me back. Compose key is set to AltGr through Gnome keyboard settings and it was working until these issues showed up.

Code:
peligro ~ # locale -a
C
en_US
en_US.iso88591
en_US.utf8
es_ES
es_ES@euro
es_ES.iso88591
es_ES.iso885915@euro
es_ES.utf8
es_ES.utf8@euro
es_UY
es_UY.iso88591
es_UY.utf8
POSIX
pt_BR
pt_BR.iso88591
pt_BR.utf8
spanish


I've never tried Option "XkbOptions" "compose:ralt", but let's see what happens.

s_bernstein wrote:
Call genlocale to regenerate all your locales


There's no genlocale, but instead of it, there is locale-gen. I've already run this command before and there's no change.

Code:
peligro ~ # which genlocale
which: no genlocale in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.4.3:/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/qt/3/bin)

_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Feb 15, 2011 10:50 am    Post subject: Reply with quote

Have you made any significant changes to /etc/vim/vimrc or have your own ~/.vimrc ?

What did you put into that locale-gen file ? es_ES.utf8@euro is pure silliness.
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Tue Feb 15, 2011 11:42 am    Post subject: Reply with quote

VoidMage wrote:
Have you made any significant changes to /etc/vim/vimrc or have your own ~/.vimrc ?

What did you put into that locale-gen file ? es_ES.utf8@euro is pure silliness.


No, I have made no changes to vim configuration files (my own or system wide). Maybe, the only changes that could have ever happened are those made by portage when updating the system.

So, let's get rid of with es_ES.utf8@euro. It was there just for completeness and it's very improbably I'm going to use it (I have 3 more options to choose). The locale was not present when these problems appeared, but let's do it correctly.

In a few hours I can check this system and see how things will get.

Thank you very much.[/i]
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Feb 15, 2011 1:42 pm    Post subject: Reply with quote

Let me rephrase that: paste the content of that file.

UTF-8@euro is pointless - in 8bit locales @euro usually meant latin1->latin15, with utf8 that's redundant.
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Tue Feb 15, 2011 9:19 pm    Post subject: Reply with quote

Here it is:
Code:
Section "ServerLayout"

    Identifier     "Simple Layout"
    Screen         "Screen 1" 0 0
    InputDevice    "Mouse1" "CorePointer"
    InputDevice    "Keyboard1" "CoreKeyboard"
EndSection

Section "Files"

    FontPath        "/usr/share/fonts/misc"
    FontPath        "/usr/share/fonts/75dpi"
    FontPath        "/usr/share/fonts/100dpi"
    FontPath        "/usr/share/fonts/TTF"
    FontPath        "/usr/share/fonts/Type1"
EndSection

Section "Extensions"
    Option "Composite"
EndSection

Section "Module"

    SubSection     "extmod"
    EndSubSection
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"

    Identifier     "Keyboard1"
    Driver         "kbd"
    Option         "AutoRepeat" "500 30"
    Option         "XkbRules" "evdev"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "es"
    Option       "XkbOptions" "compose:ralt"
EndSection


Section "InputDevice"

    Identifier     "Mouse1"
    Driver         "mouse"
    Option         "Device" "/dev/input/mice"
    Option         "ZAxisMapping" "4 5 6 7"
    Option         "Emulate3Buttons"
EndSection

Section "Monitor"

    Identifier     "My Monitor"
    DisplaySize     1440    900
    HorizSync       30.0 - 83.0
    VertRefresh     50.0 - 75.0
    ModeLine       "1440x900_60.00" 106.5 1440 1520 1672 1904 900 901 904 932 -hsync +vsync
    Option         "DPMS"
    Option      "ReducedBlanking"
EndSection

Section "Device"

    VideoRam      262144   
    Identifier     "* Generic VESA compatible"
    Driver       "nvidia"
    Option       "RenderAccel"      "true"
    Option       "AllowGLXWithComposite"   "true"
    Option        "ReducedBlanking"      "true"
EndSection

Section "Screen"
    Identifier     "Screen 1"
    Device         "* Generic VESA compatible"
    Monitor        "My Monitor"
    DefaultDepth    24

    Option      "AddARGBGLXVisuals"      "true"
    Option      "DisableGLXRootClipping"   "true"

    SubSection     "Display"
        Viewport    0 0
        Depth       24
        Modes      "1440x900_60.00"
    EndSubSection
EndSection

Section "ServerFlags"
       Option  "AllowEmptyInput"   "false"
EndSection

Greetings.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Feb 15, 2011 10:00 pm    Post subject: Reply with quote

I've meant /etc/locale.gen, but as you attached this one...
Any reason for '"AllowEmptyInput" "false"' ?
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Tue Feb 15, 2011 10:31 pm    Post subject: Reply with quote

This is /etc/locale.gen. You'll see that es_ES.utf-8@euro is no longer in this file.

Code:
en_US.UTF-8 UTF-8
en_US ISO-8859-1
pt_BR.UTF-8 UTF-8
pt_BR ISO-8859-1
es_ES.UTF-8 UTF-8
es_ES ISO-8859-1
es_ES@euro ISO-8859-15
es_UY.UTF-8 UTF-8
es_UY ISO-8859-1

And about AllowEmptyInptu:

Option "AllowEmptyInput" "boolean"

If enabled, don't add the standard keyboard and mouse drivers, if there are no input devices in the config file. Enabled by default if AutoAddDevices and AutoEnableDevices is enabled, otherwise disabled. If AllowEmptyInput is on, devices using the kbd, mouse or vmmouse driver are ignored.


It's from man xorg.conf. I'll try Xorg without this option.

Greetings and thank you very much.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Wed Feb 16, 2011 2:19 am    Post subject: Reply with quote

Any reason for not simply using evdev driver ?
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Wed Feb 16, 2011 11:20 am    Post subject: Reply with quote

VoidMage wrote:
Any reason for not simply using evdev driver ?


Not at all... do you mean setting InputDevice section regarding keyboard this way?

Code:
Section "InputDevice"

    Identifier     "Keyboard1"
    Driver         "evdev"
    Option         "AutoRepeat" "500 30"
    Option         "XkbRules" "evdev"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "es"
    Option       "XkbOptions" "compose:ralt"
EndSection


Greetings and thank you very much.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Wed Feb 16, 2011 11:48 am    Post subject: Reply with quote

What I'm trying to say is that unless you have a very good reason not to,
you should drop 'Option "AllowEmptyInput" "false"' line and just use InputClass
- on general, it makes a cleaner xorg.conf.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Wed Feb 16, 2011 11:59 am    Post subject: Reply with quote

In other places people recommend not to set LC_ALL in order to avoid " setlocale: LC_ALL: cannot change locale (pt_BR.UTF-8 ) " error. The http://www.gentoo.org/doc/en/guide-localization.xml also recommends not to set it. Set only specific variables that you really need.

The Xorg configuration should be OK as it is. Well, if it worked before switching to UTF-8, then there's no reason for it not to work now. I mentioned about XkbOption only because I didn't know that you set it via gnome.
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Wed Feb 16, 2011 4:46 pm    Post subject: Reply with quote

VoidMage wrote:
What I'm trying to say is that unless you have a very good reason not to,
you should drop 'Option "AllowEmptyInput" "false"' line and just use InputClass
- on general, it makes a cleaner xorg.conf.


Ok. Let's try it. As I'm configuring a keyboard using kbd driver, I set that option up. I'll check how to configure Xorg to use InputClass and then drop AllowEmptyInput.

Thank you very much.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Thu Feb 17, 2011 11:43 pm    Post subject: Reply with quote

Well, I think things are getting better. Right now this is xorg.conf:

Code:
Section "ServerLayout"

    Identifier     "Simple Layout"
    Screen         "Screen 1" 0 0
    InputDevice    "Mouse1" "CorePointer"
    InputDevice    "Keyboard1" "CoreKeyboard"
EndSection

Section "Files"

    FontPath        "/usr/share/fonts/misc"
    FontPath        "/usr/share/fonts/75dpi"
    FontPath        "/usr/share/fonts/100dpi"
    FontPath        "/usr/share/fonts/TTF"
    FontPath        "/usr/share/fonts/Type1"
EndSection

Section "Extensions"
    Option "Composite"
EndSection

Section "Module"

    SubSection     "extmod"
    EndSubSection
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"

    Identifier     "Keyboard1"
    Driver         "kbd"
    Option         "AutoRepeat" "500 30"
    Option         "XkbRules" "xorg"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "es"
EndSection


Section "InputDevice"

    Identifier     "Mouse1"
    Driver         "mouse"
    Option         "Device" "/dev/input/mice"
    Option         "ZAxisMapping" "4 5 6 7"
    Option         "Emulate3Buttons"
EndSection

Section "Monitor"

    Identifier     "My Monitor"
    DisplaySize     1440    900
    HorizSync       30.0 - 83.0
    VertRefresh     50.0 - 75.0
    ModeLine       "1440x900_60.00" 106.5 1440 1520 1672 1904 900 901 904 932 -hsync +vsync
    Option         "DPMS"
    Option      "ReducedBlanking"
EndSection

Section "Device"

    VideoRam      262144   
    Identifier     "* Generic VESA compatible"
    Driver       "nvidia"
    Option       "RenderAccel"      "true"
    Option       "AllowGLXWithComposite"   "true"
    Option        "ReducedBlanking"      "true"
EndSection

Section "Screen"
    Identifier     "Screen 1"
    Device         "* Generic VESA compatible"
    Monitor        "My Monitor"
    DefaultDepth    24

    Option      "AddARGBGLXVisuals"      "true"
    Option      "DisableGLXRootClipping"   "true"

    SubSection     "Display"
        Viewport    0 0
        Depth       24
        Modes      "1440x900_60.00"
    EndSubSection
EndSection

Section "ServerFlags"
       Option  "AllowEmptyInput"   "false"
       Option  "AutoAddDevices"      "false"
EndSection


This file AND disabling compose key setting in Gnome made AltGr work again. A very interesting point is if I set AltGr as compose key in Gnome, then I can not type #, @, ¬, etc, etc. Do it using Option "XkbOptions" "compose:ralt" makes things stop working.

Now, the problem is another one: how to type, for exemplo, ã. :lol:

Let's see what I find about it.

Greetings and thank you everyone for their time.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
cibonato
Apprentice
Apprentice


Joined: 25 Apr 2006
Posts: 200
Location: Macross City

PostPosted: Fri Feb 18, 2011 12:14 am    Post subject: Reply with quote

Done!

I had to set Right Control as compose key and this problem is solved.

Thank you so much.
_________________
64 Bits, good good!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum