LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2006, 04:18 AM   #1
phuna
LQ Newbie
 
Registered: Jul 2005
Posts: 13

Rep: Reputation: 0
syslog and utf-8


Hi all,
I use syslog for my program to log all information. Now I encounter a problem with Japanese and UTF-8 encoding: all UTF-8 characters written to syslog are not readable, like this:

æ\226°ã\201\227ã\201\204ã\203\225ã\202(c)ã\203«ã\203\200

If I use EUC encoding, there's no problem.
I've read somewhere that syslog can only handle 7-bit characters, is it right?
Is there any way to make UTF-8 string readable in syslog?

Any help would be appreciated.

Thanks in advance.

--
Nguyen Anh Phu
 
Old 07-19-2006, 01:19 AM   #2
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
I suspect your current locale is set to EUC, that's why utf shows as garbage. syslog should handle none 8-bit clean fine. Afterall, EUC isn't 8-bit clean either.
 
Old 07-19-2006, 02:17 AM   #3
phuna
LQ Newbie
 
Registered: Jul 2005
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for your reply.

I've tried to set system locale to ja_JP.UTF-8 and jp_JP.EUC-JP, in both case, UTF-8 strings always unreadable. EUC string works as expected, it's readable if locale is EUC, unreadable if locale is UTF-8
 
Old 07-19-2006, 04:56 AM   #4
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
do you have the locale files for ja_JP.utf8 installed?
check your /usr/lib/locale directory.
 
Old 07-19-2006, 08:46 PM   #5
phuna
LQ Newbie
 
Registered: Jul 2005
Posts: 13

Original Poster
Rep: Reputation: 0
I found nothing in /usr/lib/locale directory only 1 file named locale-archive.

Code:
$ file /usr/lib/locale/locale-archive
/usr/lib/locale/locale-archive: PDP-11 separate I&D executable not stripped
I'm using Debian 3.1 and I use "dpkg-reconfigure locales" to install locales, after that I switch system locale from GDM menu.
I found that in /usr/share/locale there are:
Code:
$ ls
af	       be  da		en_AU  et     gl  is	 lg	       ml     nn     pl_PL  se	     sv  uz	  zh_CN
all_languages  bg  de		en_CA  et_EE  gu  it	 li	       mn     no     pt     sk	     ta  uz@Latn  zh_CN.GB2312
am	       bn  de.UTF-8	en_GB  eu     he  it_IT  locale.alias  mr     no_NO  pt_BR  sl	     tg  vi	  zh_HK
ang	       br  de_AT	en_US  eu_ES  hi  ja	 lt	       ms     no_nb  pt_PT  sp	     th  wa	  zh_TW
ar	       bs  el		eo     fa     hr  ka	 lv	       nb     nso    rm     sq	     tk  xh	  zh_TW.Big5
as	       ca  en		es     fi     hu  kn	 mg	       ne     or     ro     sr	     tl  yi	  zu
az	       cs  en@boldquot	es_ES  fr     ia  ko	 mi	       nl     pa     ru     sr@Latn  tr  yo
az_IR	       cy  en@quot	es_MX  ga     id  l10n	 mk	       nl_NL  pl     rw     sr@ije   uk  zh
Are they locale files? If not, where can I find locale files on my system?
 
  


Reply



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
LXer: Centralized Syslog Server Using syslog-NG LXer Syndicated Linux News 0 04-28-2006 06:21 PM
Kooka and UTF-8 J_Szucs Linux - Software 2 08-23-2005 10:06 AM
How do I know how a file is encoded? UTF-8, UTF-16, etc.. ?? brynjarh Linux - General 1 12-03-2004 11:11 AM
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 05:20 AM
X11 / UTF-8 locale seems missing 'fr_FR.UTF-8' chrsitophermann Debian 11 07-17-2004 02:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration