LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-21-2009, 07:45 AM   #1
jmandrak
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Rep: Reputation: 0
Special chars on filename problems with Centos and Apache


Hi all,

I have a webserver runing centos and apache.
One of my client's site was hosted on Windows and I've mirrod his site using lftp.

Now I have a problem with files with accented words, like "duração.jpg", "foto do café.jpg" and others.

On the command line a "ll" shows the folowing:
duração.jpg -> dura\347\343o.jpg
foto do café.jpg -> foto\ do\ caf\351.jpg

However, the pictures does not shows correctly on the browsers, and inspecting apache's error log I could find that it's trying to load "dura\xc3\xa7\xc3\xa3o.jpg" or "foto do caf\xc3\xa9.jpg".

How could I rename all of these files? Would there be a .htaccess rewrite rule for that?

I've searched around the web today and found about the command rename. I've tried a few commands but no success, also, I'm not that good with regular expressions.
 
Old 07-21-2009, 12:48 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, welcome to LQ!

You may be after something like this:
http://sharealike.org/index.php/2008...iles-to-utf-8/

Of course I don't know *which* actual windows encoding may
have been in use to get the Brazilian characters ...



Cheers,
Tink
 
Old 07-21-2009, 12:59 PM   #3
jmandrak
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Tinkster

Thanks for your link, but the problem would be the file name itselft, not it's content.

It seems that the real problem here is that browsers requests the files using UTF-16 (?).

I've been testing out this requests and while browsers fail to retrieve the files, download tools such as GetRight can grab the files perfectly.

Unfortunatelly I don't see many other solutions other than creating a script that will rename all files and replace the html contents with the new file name. This would be safer for the future, and better for the client. Also, They will have to learn with their mistake.
 
Old 07-21-2009, 01:36 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
ok, I get it :}

Try this
http://www.j3e.de/linux/convmv/



Cheers,
Tink
 
Old 07-21-2009, 07:19 PM   #5
jmandrak
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up Superb!!

Tink,

Thanks for your help! Worked like a charm!
I'll keep this convmv script for my life!

I owe you a beer man! Thanks a ton!

Last edited by jmandrak; 07-21-2009 at 07:20 PM.
 
Old 07-21-2009, 07:20 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you are working in konsole, does it help changing the encoding to utf8?

I've noticed that some commands don't play nice with these filenames.

Code:
ls dur*.jpg
dura????o.jpg

ls dur*.jpg | cat
duração.jpg
If the files are on vfat or ntfs partitions, use the "nls=utf8" mount option. Also the nls_utf8 kernel module needs to be loaded.
 
Old 07-21-2009, 07:37 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by jmandrak View Post
Tink,

Thanks for your help! Worked like a charm!
I'll keep this convmv script for my life!

I owe you a beer man! :D Thanks a ton!
Heh ... I'll hold you to that if I ever visit the
place where you live ;D





Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in replacing special chars using awk linux_vidhyarthi Linux - General 2 04-09-2008 07:39 PM
bash, filenames, special chars zomane Programming 3 06-15-2007 04:55 AM
Problem with special chars in general smokylux Linux - General 6 05-26-2004 04:46 AM
German umlaute (special chars) in file system steltner Linux - General 5 10-27-2003 02:07 PM
telnet and special chars csDraco_ Slackware 7 05-21-2003 09:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration