samy
samy

Reputation: 1440

How do i change the character encoding of this file with iconv or recode?

I have a text file that is ISO-8859-1 encoded. I need it utf-8 encoded. Firefox displays the quote and single quote characters correctly but gedit doesn't:
Firefox:
For The Home Depot?
“Absolutely,” he said at the time.
Home Depot said Nardelli’s decision

gedit:
For The Home Depot?
ÂAbsolutely, he said at the time.
Home Depot said NardelliÂs decision

I tried:

iconv -f ISO-8859-1 -t UTF-8 Bus16451112.txt > iconv.txt

and

recode ISO-8859-1..UTF-8 Bus16451112.txt

Both didn't work. After the conversion firefox displays the characters wrong too regardless if i choose utf-8 ( Absolutely, he said at the time. ) or ISO-8859-1 ( “Absolutely,” he said at the time. ) in the view menu.

What do i have to do to get this file converted to UTF-8 so it gets displayed correctly?

Upvotes: 2

Views: 812

Answers (1)

Jörn Horstmann
Jörn Horstmann

Reputation: 34024

Your text file is most certainly not encoded in ISO-8859-1 since that character set does not contain the typographical quote characters. The encoding is probably Windows-1252, which replaces some control characters of ISO-8859-1 with other more useful characters. You should be able to convert it with iconv like this:

iconv -f Windows-1252 -t UTF-8 q8402932.txt > iconv.txt

Upvotes: 2

Related Questions