LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   xterm garbage characters (https://www.linuxquestions.org/questions/linux-software-2/xterm-garbage-characters-757530/)

MTK358 09-24-2009 12:07 PM

xterm garbage characters
 
I noticed that in xterm, a lot of characters are shown as "â" instead of what's supposed to be there. This character often replaces the apostrophe in man pages and makes gcc error messages useless by turning the faulty code samples into garbage characters. This does not happen in gnome-terminal.

Here is a sample error from gcc, as shown in xterm:

Code:

error: â has no member named â

MensaWater 09-24-2009 12:38 PM

This has to do with the LANG environment variable - type echo $LANG and you'll likely see something like:
en_US.UTF-8

If the terminal session you're using is not using that translation you'll see oddities. For example the default "translation" in PuTTY terminals is "ISO-8859-1:1998 (Latin-1, West Europe)". If you change it to be UTF-8 it matches the the shell variable mentioned above and gets rid of the garbage.

So the question is when you say "xterm" do you mean the xterm termtype (which is used in things like PuTTY and other emulators) or do you mean the actual "xterm" X Window program. If the latter you'll have to work out what your particular implementation is using for default translation.

Shadow_7 09-24-2009 05:48 PM

It has to do with the LANG var and the unicode characteristics of your system. It also has to do with the FONT being used by your xterm.

MTK358 09-24-2009 07:02 PM

Quote:

Originally Posted by jlightner (Post 3695797)
So the question is when you say "xterm" do you mean the xterm termtype (which is used in things like PuTTY and other emulators) or do you mean the actual "xterm" X Window program. If the latter you'll have to work out what your particular implementation is using for default tranlation.

I am talking about an xterm window.

MensaWater 09-25-2009 07:56 AM

Interesting - I just found a program called "luit" that will run your program with UTF-8. It came with xorg-x11-apps package so you likely have it as well.

Typing "luit man <manpage>" may solve your problem in an xterm window. Or maybe you need to launch it with "luit xterm". Both commands worked for me

MTK358 09-25-2009 11:28 AM

launching a terminal using "luit xterm" didn't help.

MensaWater 09-25-2009 03:39 PM

Did you try "luit man <manpage>"?

MTK358 09-25-2009 07:37 PM

Didn't help either.

But I am more concerned about the compiler (because errors are rendered almost useless) than about man pages (where it is just a small nuisance).

MensaWater 09-27-2009 07:15 AM

Did you verify LANG variable is set to UTF-8 (en_US.UTF-8)?

I recall having resolved similar issue some time ago by changing LANG variable to C:
export LANG=C

massysett 09-27-2009 07:31 AM

I am having a similar problem:

http://www.linuxquestions.org/questi...rectly-758003/

MTK358 09-27-2009 04:23 PM

Quote:

Originally Posted by jlightner (Post 3698454)
Did you verify LANG variable is set to UTF-8 (en_US.UTF-8)?

How do you do that?

MTK358 09-27-2009 04:26 PM

I figured it out, it's:

Code:

en_US.UTF-8

MensaWater 09-28-2009 08:55 AM

To see what a variable is set to you do "echo $VAR" so in this case it would be "echo $LANG".

To change the variable do the "export LANG=C" I mentioned above. To change it back to the "export LANG=en_US.UTF-8"

Note these only change it for your current session. You'd have to modify your .bash_profile or .bashrc to make the change permanent. Don't do that until you determine if setting it at command line has resolved your issue.

MTK358 09-29-2009 08:02 AM

I found that "export LANG=C" worked, but how do I make it permanent, and what is C?


All times are GMT -5. The time now is 02:35 AM.