File Encoding Conversion

Posted by Paolo Wed, 27 Feb 2008 18:47:00 GMT

This morning I struggled a bit to find a decent encoding converter for osx… from time to time I get stuck on encoding issues so I wanted to have something ‘friendly’ to handle this kind of problems…

I found Cyclone based on Apple Text Encoding Converter (look for TEC) but it kept failing in some strange ways (It gave me weird messages about converters creation). After googling for a while I gave up. It seems there are no good-free-GUI alternatives on the net…

Sometimes the solution is closer than you think and the good old iconv rescued me in a snap:

[paolo@fingus]$ iconv -f UTF-16 -t UTF-8 utf16_file.txt > utf8_file.txt

you can list the available encodings with:

[paolo@fingus]$ iconv -l

The cool part is you can use it in conjunction with TextMate’s Filter Through Command feature thus enabling in-editor lightning-fast conversions.

The only missing part was discovering the original file’s encoding, in order to pass iconv the correct -f option. The not-so-reliable way I used was to open the file with Firefox and inspect the encoding using the View -> Character Encoding menu item.

That’s it, problem solved. If you know better ways to do this… let me know!

Socialize it: Add to del.icio.us Digg it! Technorati: File Encoding Conversion Add to reddit.com

Posted in  | Tags  | 1 comment | no trackbacks

Cannot change charset from 'UTF8' to 'UTF-8'

Posted by Paolo Fri, 14 Apr 2006 20:24:00 GMT

A few months ago I run into a problem using Tapestry over BEA Weblogic 8.1 SP2. During the execution of a beginPageRender I issued a redirection and got a weird:

     org.apache.hivemind.ApplicationRuntimeException: 
     Attempt to change ContentType after calling getWriter() 
     (cannot change charset from 'UTF8' to 'UTF-8')

Many people from the Tapestry mailing list continue to ask me a solution to this problem so I’m posting it here for future reference.

Socialize it: Add to del.icio.us Digg it! Technorati: Cannot change charset from 'UTF8' to 'UTF-8' Add to reddit.com

Read more...

Posted in  | Tags , , , , , , , ,  | 2 comments


SeeSaw srl - Via Monte Pasubio, 8 37126 Verona - tel +39 045 4857457 fax 045 4851151 P.Iva 03609790237