Welcome Guest, Not a member yet? Register   Sign In
Upload files with UTF characters
#1

[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 ?
#2

[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.
#3

[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 ?
#4

[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
#5

[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 ?




Theme © iAndrew 2016 - Forum software by © MyBB