LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-25-2008, 04:19 AM   #1
tramni1980
Member
 
Registered: Jul 2006
Location: Tübingen, Germany
Distribution: Slackware64-13.37
Posts: 737

Rep: Reputation: 37
utf8 cyrillic text in console emacs


Hello!
I am running Slackware 12.1.
I want to use emacs without X, i.e. in the console only and write utf8 encoded cyrillic text. Is there a way to achieve that?
In the Changes and Hints file there was something about enabling utf8 console, probably that is what I should do, but Patrick warns that there is some danger of misinterpretation of some commands. So can I achieve my goal without running into this risk? I wish I could leave everything in english on my machine, I just want to write utf8 cyrillic text by means of console emacs.

Regards,
Martin
 
Old 08-25-2008, 05:15 AM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
console can be switched into unicode mode by running unicode_start.
This can be done inside /etc/rc.d/rc.font.
This will break midnight commander (patched version "mc-4.6.1_utf8-i486-1pin.tgz" is available somewhere).
if your kernel is 2.6.24 or higher, then console is in unicode mode by default.
 
Old 08-25-2008, 05:36 AM   #3
tramni1980
Member
 
Registered: Jul 2006
Location: Tübingen, Germany
Distribution: Slackware64-13.37
Posts: 737

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by ErV View Post
console can be switched into unicode mode by running unicode_start.
This can be done inside /etc/rc.d/rc.font.
if your kernel is 2.6.24 or higher, then console is in unicode mode by default.
My kernel is 2.6.24.5-smp. I ran the script unicode_start and tried to open a utf8 text file. I switched the language environment to Bulgarian. And still all that was displayed in the console was:
????????????????????????????????????????????
????????????????????????????
and so on. Besides, how do I switch in the console from cyrillic to latin keyboard layout?
 
Old 08-25-2008, 08:11 AM   #4
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by tramni1980 View Post
My kernel is 2.6.24.5-smp. I ran the script unicode_start and tried to open a utf8 text file. I switched the language environment to Bulgarian. And still all that was displayed in the console was:
????????????????????????????????????????????
????????????????????????????
Have you configured console font? If it doesn't have bulgarian characters, you won't see them.
Take a look at this thread and make sure you set system locale and console font correctly.

Quote:
Originally Posted by tramni1980 View Post
Besides, how do I switch in the console from cyrillic to latin keyboard layout?
With right control key (on my machine, at least). That's of course if you configured console keyboard correctly.
--EDIT--
Basically, to make any console program to display any characters you must make sure, that:
1) terminal is set to correct encoding
2) terminal font has characters you need and correct character map is selected.
3) program communicates with terminal in same encoding terminal is set to. I.e. if terminal will be cp855 and program will communicate with it as if it was utf8 this won't make any good.

I don't know how to #3 in emacs. Normally setting system locale to the one used by terminal should be enough.

It doesn't really matter wheter it is unicode or not.

Last edited by ErV; 08-25-2008 at 08:17 AM.
 
1 members found this post helpful.
Old 08-25-2008, 11:03 AM   #5
tramni1980
Member
 
Registered: Jul 2006
Location: Tübingen, Germany
Distribution: Slackware64-13.37
Posts: 737

Original Poster
Rep: Reputation: 37
Ok, thank you very much I will try these.
I have just something else to ask before I switch to tweaking.
1. I want to minimize the risk of some commands being misinterpreted due to the bg_BG.utf8 locale I am going to set. So what environment variables shall I export? All I want is just being able to type cyrillic in emacs. Nothing more.
Is it:
Code:
export LANG=bg_BG.utf8
export LC_MESSAGES=en_US
2. Which font shall I set:
Will this:
Code:
setfont -v koi8c-8x16 -u koi8r
do for utf8 Bulgarian? Bulgarian does not have letters that are not present in Russian.

3. I found I have:
/usr/share/kbd/keymaps/i386/qwerty/bg_bds-utf8.map.gz
so I will do:

Code:
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys ru-ms.map
fi
4. For my purpose, do I have to add:
Code:
Option         "XKbLayout" "us,ru(winkeys)"
to the other necessary lines in the Device Section of xorg.conf?
Are these extra lines in xorg.conf that configure the console keyboard?

Thank you for your attention.

Regards,
Martin
 
Old 08-25-2008, 11:10 AM   #6
tramni1980
Member
 
Registered: Jul 2006
Location: Tübingen, Germany
Distribution: Slackware64-13.37
Posts: 737

Original Poster
Rep: Reputation: 37
Sorry for cross-posting, but I made a mistake with the 3rd point:

it should be:

3. I found I have:
/usr/share/kbd/keymaps/i386/qwerty/bg_bds-utf8.map.gz
so I will do:

Code:
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys bg_bds-utf8.map
fi
Is there anything else to do in addition to these 4 steps?
 
Old 08-25-2008, 11:10 AM   #7
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
xorg.conf doesn't really have anything to do with console. Though, usually, to be able to switch between Latin and Cyrillics in X programs, you do something like this in your xorg.conf

Option "XkbLayout" "us,ru(winkeys)"
Option "XkbOptions" "grp:ctrl_shift_toggle,grp_led:scroll"
 
Old 08-25-2008, 12:07 PM   #8
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by tramni1980 View Post
2. Which font shall I set:
Will this:
Code:
setfont -v koi8c-8x16 -u koi8r
do for utf8 Bulgarian? Bulgarian does not have letters that are not present in Russian.
Don't know. You should seek stanard encoding for your language (I really don't think it is koi8-r), anyway. I've been configuring all this stuff more than year ago, and I don't remember a lot of details.
Take a look at "man setfont". From what i remember it has a lot of details about how exactly terminal works, where are available fonts, keyboard maps and unicode maps (the ones given with setfont's "-u" option) stored.
There should be more manpages about subject, but I don't remember their exact names (you should be able to find them by setfont's manpage references)
According "man setfont" there are following important directories:
/usr/share/kbd/unimaps
/usr/share/kbd/consolefonts
/usr/share/kbd/consoletrans
"consolefonts" directory have several readme's, so take a look at them.
reading "man loadkeys" and "man unicode_start" also might provide several insights.

Quote:
Originally Posted by tramni1980 View Post
3. I found I have:
/usr/share/kbd/keymaps/i386/qwerty/bg_bds-utf8.map.gz
so I will do:

Code:
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys ru-ms.map
fi
"loadkeys ru-ms" will load russian keyboard layout. I don't know if it is identical to bulgarian keyboard or not.

Quote:
Originally Posted by tramni1980 View Post
4. For my purpose, do I have to add:
Code:
Option         "XKbLayout" "us,ru(winkeys)"
No.

I'd like to provide more info, but, unfortunately, right now I'm using broken monitor which refuses to display anything except 1024x768x85 hz screen mode (so I don't see "normal" terminals at all), so I won't be able to play around with terminal settings and probably won't be able to provide further assistance.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to toggle between keyboard maps in console-cyrillic? bezdomny Linux - Software 2 08-03-2008 06:59 PM
deadkeys don't work in utf8 console gmels Linux - General 1 09-14-2007 06:20 AM
Slackware cyrillic fonts console problem mirr0red Slackware 0 08-05-2004 03:47 AM
accessing emacs menu when in console edsmithers Linux - Software 3 02-11-2004 05:57 PM
EMACS-text editor TrippyChik Linux - Software 10 10-17-2003 09:36 AM


All times are GMT -5. The time now is 07:26 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration