LinuxQuestions.org
Visit Jeremy's Blog.
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 04-04-2007, 09:44 AM   #1
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
iconv - why does it club and form a single character


Hi,

Puzzled why does iconv convert the following in a peculiar way.

Following is the example text..
Code:
dfsønne H converu
Code:
iconv -f UTF-8 -t ISO-8859-1 < file
dfsønne H converu
Code:
ø ====>  ø
Any reason, why the two characters are clubbed together to form ø in latin1 encoded format.

Is there any pattern to be followed for iconv conversion ?

Basically my question is how does iconv select characters that are to be clubbed ( from utf-8 input ) and convert to a character ( latin1 )

Any pointers, much appreciated!

Thanks
 
Old 04-05-2007, 07:16 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 79
The issue here is quite interesting. Iconv does not “club” your characters. What happens is that your terminal is set to display utf8, and doesn’t know the output from iconv will be in latin1. So the input “ø” (which is in utf8 0xc383 followed by 0xc2b8) get’s converted as it should be to “ø” (which is in latin1 0xc3 followed by 0xb8). Your terminal thinks stdout should be interpreted as being in utf8, so it reads this as one character 0xc3b8, which translates in utf8 to ø.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to output a single character several times? daYz Programming 5 09-15-2006 02:24 PM
shell script works form command line but not form crontab saifee General 1 10-14-2004 11:27 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 07:40 PM
Sylpheed / iconv problem dorakyura Linux - Software 1 01-04-2004 03:29 PM
iconv command saravanan1979 Linux - Software 1 07-06-2002 12:55 PM

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

All times are GMT -5. The time now is 05:17 PM.

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