Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > problems with ISO vs UTF in the terminal

problems with ISO vs UTF in the terminal
Thread Tools
Fresh-Faced Recruit
Join Date: Mar 2007
Status: Offline
Reply With Quote
Mar 27, 2007, 07:26 PM
 
Hi,

When I configure my terminal, in "Terminal > Window Preferences > Monitor" I chose Unicode (UTF-8) as the character group encoding.

Now, I've got an xml file which seems to contain only ASCII text:

rc52:~$ file caca.xml
caca.xml: ASCII text, with no line terminators

If I translate any characters on the command line, I get an ISO file:

rc52:~$ perl -p -e 'tr/$,?/€,¿/' caca.xml > CACA.TXT
rc52:~/crp/txt/myAnn3 souto$ file CACA.TXT
CACA.TXT: ISO-8859 text, with no line terminators

So that I need to iconv the file in order to see the characters because all my editors and tools expect UTF files, not ISO.

Any ideas why this happens or how I can revert it?

Thanks, xinelo
     
Senior User
Join Date: May 2002
Location: Austria
Status: Offline
Reply With Quote
Mar 28, 2007, 04:58 AM
 
You have to use perl's UTF-8 declaration to make perl work with UTF-8 encoded files.
Modify your script so that it looks like this:

perl -p -e 'use utf8;tr/$,?/€,¿/;' caca.xml > CACA.TXT

Then it will output a correctly encoded file.
     
xinelo  (op)
Fresh-Faced Recruit
Join Date: Mar 2007
Status: Offline
Reply With Quote
Mar 29, 2007, 03:23 AM
 
thank you Tsilou,

I didn't know this option. In fact I think it'll solve other problems that I had and I didn't know why.

cheers, xinelo
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:39 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2