SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I usually like use vim to edit source code, even in my X (fluxbox). One problem is, if in gvim I can see Chinese characters (as comments in some of my source code), but in vim (open in konsole terminal program), the same Chinese characters only displayed as unrecognized strange string.
In both gvim and Konsole, I configured to use the same font, Bitstream Versa Sans Mono. I don't understand, with the same font setting, why gvim can display Chinese but konsole+vim can not.
I've heard of a lot of problems with Konsole and unicode characters. I could be wrong, but I'm not sure that Konsole has full unicode support. If you don't know otherwise, you might want to try another terminal that we know does have it, such as rxvt-unicode.
I don't think there is something wrong with konsole. The OP may want to post an example file to demonstrate the problem if he really can't get rid of multi-byte characters from his source code.
I've heard of a lot of problems with Konsole and unicode characters. I could be wrong, but I'm not sure that Konsole has full unicode support. If you don't know otherwise, you might want to try another terminal that we know does have it, such as rxvt-unicode.
Hi, Blooming. I just tried rxvt-unicode, it works! A Vim run in it can display Chinese!
Another thing, then how do I change the (English) font used by rxvt-unicode? I prefer Bitstream Versa Sans Mono.
I don't think there is something wrong with konsole. The OP may want to post an example file to demonstrate the problem if he really can't get rid of multi-byte characters from his source code.
Hi, Blooming. I just tried rxvt-unicode, it works! A Vim run in it can display Chinese!
Another thing, then how do I change the (English) font used by rxvt-unicode? I prefer Bitstream Versa Sans Mono.
Good news. I'm glad that was the only problem. You can read this to learn more about how to configure your ~/.Xresources file to change fonts, colors, and other settings:
I don't think there is something wrong with konsole. The OP may want to post an example file to demonstrate the problem if he really can't get rid of multi-byte characters from his source code.
Guanx, interesting in see your screenshot. It seems your vim can display Chinese. I'd already set my localte to GBK, but don't know why I can't see the Chinese welcome screen of vim -- I just get English.
Below are some screenshots related to the topic. Do you have a clue about the problem? Thanks.
and restart urxvt to see the new font (or restart X).
I did the same thing, but the fonts get rendered very urgly. It looks too small, and have too much space between characters. You can check the attached screen shot. Don't know where the problem come from.
Another very strange thing is: the urxvt can display Chinese only when it is started from Konsole! If I start it directly (from fluxbox 'run' command or from fluxbox menu), it cannot display Chinese. What's wrong? Thanks.
Did you ever edit your /etc/profile.d/lang.sh file before this? In order to support Unicode text, I believe you need to edit that file and change the line that says
Code:
# en_US is the Slackware default locale:
export LANG=en_US
to
Code:
# en_US is the Slackware default locale:
export LANG=nl_NL.UTF-8
Also, I do not use Konsole, but there should be a setting in the menu somewhere that let's you set it to use UTF-8 directly. Try Settings -> Encoding -> Unicode (utf8).
Did you ever edit your /etc/profile.d/lang.sh file before this? In order to support Unicode text, I believe you need to edit that file and change the line that says
Code:
# en_US is the Slackware default locale:
export LANG=en_US
to
Code:
# en_US is the Slackware default locale:
export LANG=nl_NL.UTF-8
Also, I do not use Konsole, but there should be a setting in the menu somewhere that let's you set it to use UTF-8 directly. Try Settings -> Encoding -> Unicode (utf8).
Hi Blooming, many thanks for your hints! My Konsole char encoding setting is "using default: utf-8". So, in the past, I've already thinking that it is okay and never change it. After read your post, I tried to change it to GBK. On the other hand, my /etc/profile.d/lang.sh is also GBK (zh_CN.gbk). Then, after reboot X, I found Konsole works! It can display Chinese without problem! I am so happen, though I still don't understand why setting these to utf-8 did not work.
On the other hand, even urxvt can display Chinese in previous locale setting (I have to run it with 'bash -l -c urxvt'), but it font rending is really poor than Konsole. Konsole looks more nice to me.
..., though I still don't understand why setting these to utf-8 did not work. ...
From your screenshot you're displaying a text file in GBK encoding as UTF-8. of course this does not work.
I think the best way to avoid encoding problems is to not use multi-byte character in C source code but use "gettext".
If you really have political problems (e.g. your boss forces you to embed Chinese in C source code), please use the UTF-8 encoding, and set your locale to zh_CN.UTF-8.
From your screenshot you're displaying a text file in GBK encoding as UTF-8. of course this does not work.
I think the best way to avoid encoding problems is to not use multi-byte character in C source code but use "gettext".
If you really have political problems (e.g. your boss forces you to embed Chinese in C source code), please use the UTF-8 encoding, and set your locale to zh_CN.UTF-8.
I agree 'gettext' is good choice. The problem is that I have to work with a lot of legacy code, which already have embedded Chinese characters. Anyway, thanks for your advices!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.