UTF-8 File name returned Not found in linux terminal

I have a problem with some files in linux (Ubuntu), with accents in the names. For example:

$ ls dir/ criação.png 

So, the terminal returns this file, so it exists. Now let's see if the file exists with this simple command:

 $ [ -f criação.png ] && echo "File Exist" || echo "Not Exist" Not Exist 

As you see, "Doesn't exist." Now I have the same folder and file in OSX, then I run the same command and it returns this:

 $ [ -f criação.png ] && echo "File Exist" || echo "Not Exist" File Exist 

I know a little about the locale:

 $ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE=en_US.UTF-8 LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= 

On Linux, "Doesn’t exist", on OSX, "The file exists" ... Someone, you know how to fix this?

Perhaps this may help:
http://nedbatchelder.com/blog/201106/filenames_with_accents.html
http://www.ruby-forum.com/topic/279105

UPDATE - Solution

I finally found a solution to this problem. You need to rename your files from NFD to NFC, here is the command to fix all the files:

 cd dir/ convmv -r -i -f utf8 -t utf8 --nfc --notest . 

Source: http://blog.hbis.fr/2010/08/30/macox-utf8_filenames_normalization/

+8
linux file terminal utf-8
source share
1 answer

One reason might be a file name that uses a different form of Unicode character normalization with a combination of labels than you use to enter a name. See Unicode Equivalence .

+1
source share

All Articles