How to fix a strange iconv problem on Mac Os x

I am on Mac Os X 10.5 (but I reproduced the 10.4 issue)

I am trying to use iconv to convert a UTF-8 file to ASCII

Utf-8 file contains characters like 'éàç'

I want accented characters to turn into their closest ascii equivalent

So

my command :

iconv -f UTF-8 -t ASCII // TRANSLIT // IGNORE myutf8file.txt

which works fine on a Linux machine

but on my local Mac Os X I get this, for example:

=> 'e

à => `a

I really don't underestimate why iconv returns this strange output on mac os x, but everything is fine on linux

any help? or directions?

early

+5
4

, Mac OSX iconv libiconv. Linux iconv, libc. , libiconv , ö, è ñ "o", "e" "n". - translit.h lib. ,

2, '"', 'o',

- :

1, 'o',

Google, , , . , -!

+8

, Linux- -... , iconv UTF-X, macos , "C", () , ... , iconv:

setLocale( LC_ALL, "en_EN");

| <

0

, ( : script URL- "permalink".

, iconv sed:

echo á é ç this is a test | iconv -f utf8 -t ascii//TRANSLIT | sed 's/[^a-zA-Z 0-9]//g'

OS X Yosemite:

a e c this is a test
0

- unaccent, brew install unac:

$ unaccent utf-8<<<é
e

unaccent (, LATIN SMALL LETTER E, COMBINING ACUTE ACCENT), uconv :

$ unaccent utf-8<<<$'e\u0301'
é
$ uconv -f utf-8 -t utf-8 -x NFC<<<$'e\u0301'|unaccent utf-8
e

brew install icu4c;ln -s /usr/local/opt/icu4c/bin/uconv /usr/local/bin uconv.

0

All Articles