Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED]Trouble displaying characters/bad locale config

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
pymander
Posts: 3
Joined: 2017-07-22 08:52

[SOLVED]Trouble displaying characters/bad locale config

#1 Post by pymander »

Hi, I have a sample text file with lots of different international scripts. Unfortunately no matter what program i try to view it in, it is never displayed properly.

The research I've done has lead me to the conclusion that this problem has something to do with a bad locale configuration.

Currently locale gives me this output:

Code: Select all

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_DE.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_DE.UTF-8"
LC_NUMERIC="en_DE.UTF-8"
LC_TIME="en_DE.UTF-8"
LC_COLLATE="en_DE.UTF-8"
LC_MONETARY="en_DE.UTF-8"
LC_MESSAGES="en_DE.UTF-8"
LC_PAPER="en_DE.UTF-8"
LC_NAME="en_DE.UTF-8"
LC_ADDRESS="en_DE.UTF-8"
LC_TELEPHONE="en_DE.UTF-8"
LC_MEASUREMENT="en_DE.UTF-8"
LC_IDENTIFICATION="en_DE.UTF-8"
LC_ALL=
In case you're wondering about the "en_DE" part, that is intentional.

Before I messed around with the locale settings I used to not get those three lines of error messages. I suspect the problem has something to do with the LANGUAGE environment variable not having the "UTF-8" suffix.

I tried following the instructions in the Debian wiki for setting the locale to "en_US.UTF-8" both with dpkg-reconfigure locales and manually by editing /etc/locale.gen and then running locale-gen and logging in and out but it didn't fix the problem.

I hope this post is not coming across too idiotic and someone can help me with this. Thanks.
Last edited by pymander on 2017-07-24 06:13, edited 2 times in total.

User avatar
squeeze
Posts: 299
Joined: 2010-06-14 23:16
Location: thimbleweedpark

Re: Trouble displaying Unicode characters/bad locale config

#2 Post by squeeze »

https://askubuntu.com/questions/710955/ ... s-warnings
In case you're wondering about the "en_DE" part, that is intentional.
Intentional but non-existent ;-)
“Have you tried turning it off and on again?”

pymander
Posts: 3
Joined: 2017-07-22 08:52

Re: Trouble displaying Unicode characters/bad locale config

#3 Post by pymander »

Thanks for the reply, my problem doesn't seem to be related to the "en_DE" locale.

Code: Select all

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
In case I wasn't clear, my real problem is that I want to be able to properly display as many Unicode characters as possible but I can't. For example this file:

Code: Select all

Afrikaans
አማርኛ
Аҧсшәа
العربية
Aragonés
Arpetan
Azərbaycanca
Bamanankan
বাংলা
Bân-lâm-gú
Беларуская
Български
Boarisch
Bosanski
Буряад
CatalÃ
Чӑвашла
Čeština
Cymraeg
Dansk
Deutsch
Eesti
Ελληνικά
Español
Esperanto
فارسی
Français
Frysk
Gaelg
GÃ idhlig
Galego
한국어
Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶
हिन्दी
Hrvatski
Ido
Interlingua
Italiano
עברית
ಕನ್ನಡ
Kapampangan
ქართული
Қазақша
Kreyòl ayisyen
Latgaļu
Latina
Latviešu
Lëtzebuergesch
Lietuvių
Magyar
Македонски
Malti
मराठी
მარგალური
مازِرونی
Bahasa Melayu
Монгол
Nederlands
नेपाल भाषा
日本語
Norsk bokmål
Nouormand
Occitan
Oʻzbekcha/ўзбекча
ਪੰਜਾਬੀ
پنجابی
پښتو
Plattdüütsch
Polski
Português
Română
Romani
Русский
Seeltersk
Shqip
Simple English
Slovenčina
کوردیی ناوەندی
Српски / srpski
Suomi
Svenska
Tagalog
தமிழ்
ภาษาไทย
Taqbaylit
Татарча/tatarça
తెలుగు
Тоҷикӣ
Türkçe
Українська
اردو
Tiếng Việt
Võro
文言
吴语
ייִדיש
中文
Looks like this:

Image

Before I messed around with locale settings, I got replacement characters or wrong characters instead of a byte string.

Isn't Linux supposed to be able to handle displaying these characters 'out of the box'?
This is very frustrating because I installed Debian because I was getting tired of trying to make the above file display properly in Win7 powershell.

cfb
Posts: 52
Joined: 2017-01-08 16:39
Been thanked: 5 times

Re: Trouble displaying Unicode characters/bad locale config

#4 Post by cfb »

Are you sure that your text file has indeed been written using encoding UTF-8? That is absolutely necessary for some program set up to use this encoding to display it correctly.

pymander
Posts: 3
Joined: 2017-07-22 08:52

Re:[Solved]Trouble displaying characters/bad locale config

#5 Post by pymander »

I made a stupid mistake when running dpkg-reconfigure locales. I just highlighted the locale I wanted and hit enter. I didn't realize you had to mark the desired locale by pressing space first. That only fixed my locale error messages though.

My problem is fixed now but I can't exactly say why. I'll try to remember what I did before the problem got fixed maybe that's of use to somebody.

Image

I did some more research and found out that KDE has its own locale files. I repeated a solution I found for a similar locale problem in KDE and renamed my ~/.config/plasma-locale-settings.sh and then reset my language from the KDE language menu.
In the process of trying to install Python 3.6. I accidentally upgraded my system to testing by adding the testing and experimental repos to my sources list and running apt-get upgrade. I managed to downgrade again.

Thanks anyway for your replies.

Post Reply