3

Is the uconv utility (a tool from ICU that provides Unicode normalization) available for Mac OS X?

I did not find it in homebrew and searching the web for solutions did not turn out anything useful for me.

3

My solution for you:

brew install icu4c

Read the message after install (nothing is at this moment direct available ...):

==> Caveats, This formula is keg-only, which means it was not symlinked into /usr/local.

brew list icu4c | grep uconv

/usr/local/Cellar/icu4c/55.1/bin/uconv

/usr/local/Cellar/icu4c/55.1/share/man/man1/uconv.1

And after all, here my example for using this tool for normalization (NFC) utf8 text:

/usr/local/Cellar/icu4c/55.1/bin/uconv -f utf-8 -t utf-8 -x NFC ~/Desktop/ue.txt | od -t x1

1

Not sure if it will suit your needs, but check out iconv which is coming with osx. Try iconv --list to list the supported encodings.

  • 1
    It looks like iconv only converts between character sets. Uconv converts text (unicode only) from one form to another equivalent form. – phs Aug 23 '15 at 11:48
  • What are you trying to do? man iconv states "The iconv program converts text from one encoding to another encoding." man uconv says "uconv converts [...] from one encoding to another" – madmax1 Aug 23 '15 at 11:54
  • 1
    You may do so using iconv -f <from_encoding> -t UTF-8-MAC <input>. Note that the utf-8-mac character set stands for unicode's NFD – madmax1 Aug 23 '15 at 12:21
  • 1
    Yes, it can. Use UTF-8 for unicode's NFC. I found out using google, leading me to this. Not sure where it's documented. – madmax1 Aug 23 '15 at 12:53
  • 1
    utf-8-mac is not NFD but a variant of NFD used by HFS+ where certain ranges of characters are not decomposed. printf \\uf900|/usr/local/opt/icu4c/bin/uconv -f utf-8 -t utf-8 -x NFD|xxd -p prints e8b188 (which is decomposed) but printf \\uf900|iconv -f utf-8 -t utf-8-mac|xxd -p prints efa480 (which is not decomposed). – nisetama Aug 12 '16 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .