CodeIgniter Forums
Upload files with UTF characters - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Upload files with UTF characters (/showthread.php?tid=2884)



Upload files with UTF characters - El Forum - 08-29-2007

[eluser]Référencement Google[/eluser]
Hi,

Uploading a file with a name wich contains UTF-8 characters, let's say : Céà&erfd;-0215.jpg (test name, but I am french and some people in my country will use this characters in files)

Result of uploading such a file is : CéÃ_erfd-0215.jpg

As you see, CI already make some cleaning, but not enough for this characters.
Wich way do you think I should try (maybe a hack of the upload library) to clean the file name at upload time ?


Upload files with UTF characters - El Forum - 08-29-2007

[eluser]alpar[/eluser]
is it important to keep the file name? You could rename it to a uniqueid(), or even if you do need the name, you could store the name separately in the db.


Upload files with UTF characters - El Forum - 08-30-2007

[eluser]Référencement Google[/eluser]
No, not important of course.
What I wanted is to use the CI way to do it, I mean, there is already some functions in CI Upload class that clean the file name, I would like to improve this fonctions to convert UT8 characters in a format without special characters, for exemple that will convert é to e and à to a

My question was exactly about this, how should I improve the CI original functions to do what I want ? With what kind of PHP function or maybe RegXP would you do this ?


Upload files with UTF characters - El Forum - 08-30-2007

[eluser]BravoAlpha[/eluser]
[quote author="elitemedia" date="1188437338"]Uploading a file with a name wich contains UTF-8 characters, let's say : Céà&erfd;-0215.jpg (test name, but I am french and some people in my country will use this characters in files)

Result of uploading such a file is : CéÃ_erfd-0215.jpg[/quote]
FWIW, on my system, it's renamed to: Céàerfd-0215.jpg


Upload files with UTF characters - El Forum - 08-30-2007

[eluser]Référencement Google[/eluser]
strange... but this could be that your server is configured in UTF8 maybe ?
But anyway, I would like to remove this special characters, it's not "web" characters. Any idea on how to remove them ?