Try the next commands from the terminal:

touch á.txt
$ ls

find .  -name á.txt -print

prints nothing.

My Terminal.app settings are utf8 - see here:

enter image description here

The question: How to achieve to work transprarently (Finder + command line) with UNICODE filenames?

I understand than behind the scene is the different unicode normalization, so:

$ echo á.txt | od -bc
0000000   303 241 056 164 170 164 012                                    
           á  **   .   t   x   t  \n 

and when

$touch á.txt
$ ls *.txt

$ ls *.txt | od -bc
0000000   141 314 201 056 164 170 164 012                                
           a   ́     **   .   t   x   t  \n   



As you mentioned, characters like á are stored or shown in decomposed form (LATIN SMALL LETTER A + COMBINING ACUTE ACCENT) even though most keyboard layouts insert characters in composed form (LATIN SMALL LETTER A WITH ACUTE).

The format is a variant of NFD where some ranges of characters are not decomposed. See Text Encodings in VFS:

Important: The terms used in this Q&A, precomposed and decomposed, roughly correspond to Unicode Normal Forms C and D, respectively. However, most volume formats do not follow the exact specification for these normal forms. For example, HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through U+2FAFF are not decomposed (this avoids problems with round trip conversions from old Mac text encodings).

You can convert text to the decomposed format with iconv -t utf-8-mac:

$ touch á
$ ls | tr -d '\n' | xxd -p
$ printf á | xxd -p
$ find . -name á
$ find . -name $(iconv -f utf-8 -t utf-8-mac <<< á)

You must log in to answer this question.

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