Re: What is the right way to fix LANG or locale such that quotes appear properly?



On Tuesday 05 January 2010 23:13:40 Foss User wrote:
On my terminal (PuTTY terminal), I see that the quotes are displayed
incorrectly. They appear as a with a caret over it. Here is an output:

debian:~# echo $LANG
en_IN
debian:~# gcc a.c
a.c: In function âmainâ:
a.c:6: error: âasâ undeclared (first use in this function)
a.c:6: error: (Each undeclared identifier is reported only once
a.c:6: error: for each function it appears in.)

Most likely the charset/encoding used by the en_IN locale is not what your
terminal is expecting. I'm not sure what the default charset/encoding is for
en_IN. However, most terminal software has support for unicode/utf-8 and may
default to it. If that's the case with puTTY (IIRC, it is), you might try
using the en_IN.utf8 locale instead, and configuring your terminal to expect
utf-8 and render unicode.

Currently, I am fixing by changing the LANG to en_US like this:

debian:~# export LANG=en_US
debian:~# gcc a.c
a.c: In function 'main':
a.c:6: error: 'as' undeclared (first use in this function)
a.c:6: error: (Each undeclared identifier is reported only once
a.c:6: error: for each function it appears in.)
debian:~#

en_US usually does not need characters outside of the (7-bit) ASCII character
set, and many charset/encoding combinations are compatible with (7-bit) ASCII.
This results in en_US rendering the vast majority of characters correctly no
matter what your terminal is expecting.

There are a few less-used characters in the en_US locale, most notably the
one-half faction, the one-quarter fraction, the copyright symbol, and the
trademark and registered trademark symbols. If your terminal is expecting
unicode/utf-8, it will not render these correctly in the en_US locale, but
will in the en_US.utf8 locale.

<rant stlye="addled bemoaning">
Locales, Character Sets, and Character Encodings are a bit of a pain. (7-bit)
ASCII works almost everywhere, but anything outside of that range depends on
everything in the chain between your terminal and the program you are running
to be in-sync. I know, I have 2 UNIX "jump boxes", 2 different versions of
GNU screen, and 2 different implementations of SSH between my terminal
(Konsole for KDE 4) and the Linux system I edit code on. Heaven forbid I try
and use the applications I'm modifying (say, to test), since they *require*
the use of function keys and use a pre-curses-standardization library for
"graphical" text-mode user-interfaces.
</rant>
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@xxxxxxxxxxxxxxxxx ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/

Attachment: signature.asc
Description: This is a digitally signed message part.



Relevant Pages

  • Re: Setting locale for java.util.regex at runtime
    ... >I suppose that this is in some way controlled by locale. ... only ever match ASCII characters. ... you have to use Unicode blocks ... not just the ASCII ones. ...
    (comp.lang.java.programmer)
  • Re: Binary strings, unicode and encodings
    ... > - If the input string contains characters that cannot be encoded ... if your default encoding is ASCII. ... in a character that has the 8th bit set doesn't mean the string is UTF-8 ... > depending on your locale and depending on how you assigned the string. ...
    (comp.lang.python)
  • Re: Reg multilanguage support by gnuplot
    ... The "locale" setting is need in order to interpret 1-byte character ... It is not needed if you are using UTF-8. ... type the characters directly into your command string. ... set label 1 at screen 0.2, ...
    (comp.graphics.apps.gnuplot)
  • Re: MIDP MIDlet: which characters are supported in the phone font?
    ... by the locale where the phone is meant to be used. ... "Which unicode characters does a phone support? ... >> the font set on the phone. ... > I rather doubt any of them do not also display latin letters. ...
    (comp.lang.java.programmer)
  • Re: MIDP MIDlet: which characters are supported in the phone font?
    ... you're going on about the Locale class and saying that my using ... That's why I didn't say *anything* about the font, ... > set of characters displayable by any or all phones meant for that ... Because Korean phones also display non-Korean, ...
    (comp.lang.java.programmer)