[SOLVED] german umlauts handling...

Found any bugs with any of our scripts? Post in here...

[SOLVED] german umlauts handling...

Postby tom » Sat Apr 16, 2011 6:29 pm

i am already running some installations of the "old" file hosting script.

a problem is handling from german umlauts like ä, ö, Ü and so on.

There is a way to handle them (i wrote this for the old file host):
Code: Select all
//Filename Cleanup
  $file_name = utf8_decode($file_name);
 
$replace_characters = array(
'&' => '_und_',
'Ä' => 'Ae',
'Ö' => 'Oe',
'ä' => 'ae',
'è' => 'e',
'é' => 'e',
'ö' => 'oe',
'ü' => 'ue',
'Ü' => 'Ue',
'ß' => 'ss',
' ' => '_',
'€' => 'EUR',
);
$file003 = strtr($file_name, $replace_characters);

// alle anderen Zeichen verwerfen
    $file_name = preg_replace('#[^a-zA-Z0-9_.-]#', '-', $file003);

    //Filename Cleanup ENDED


with this addition i solved all user problems with uploading files with german umlauts and then not showing then...

my problem.

If i use your great script, i have to insert the replacement in the existing section in the file upload.php.

if found that the section:
Code: Select all
$filename = $_FILES['upfile']['name'];
$filename = str_replace("'",'',"$filename");
$filename = str_replace("&",'_',"$filename");
$filename = str_replace("!",'_',"$filename");
$filename = str_replace("@",'_',"$filename");
$filename = str_replace("#",'_',"$filename");
$filename = str_replace("$",'_',"$filename");
$filename = str_replace("%",'_',"$filename");
$filename = str_replace("^",'_',"$filename");
$filename = str_replace("*",'_',"$filename");
$filename = str_replace("(",'_',"$filename");
$filename = str_replace(")",'_',"$filename");
$filename = str_replace("-",'_',"$filename");
$filename = str_replace("+",'_',"$filename");
$filename = str_replace("=",'_',"$filename");
$filename = str_replace("|",'_',"$filename");
$filename = str_replace(" ",'',"$filename");


is only active when uploading via html form.
when i upload via flash, then this does not work.

is there a way to handle this replacement table at flash uploading too?
tom
Standard Member
 
Posts: 8
Joined: Sat Apr 16, 2011 2:04 pm

Re: german umlauts handling...

Postby PeterS » Sun Apr 17, 2011 8:20 am

tom wrote:i am already running some installations of the "old" file hosting script.

a problem is handling from german umlauts like ä, ö, Ü and so on.

There is a way to handle them (i wrote this for the old file host):
Code: Select all
//Filename Cleanup
  $file_name = utf8_decode($file_name);
 
$replace_characters = array(
'&' => '_und_',
'Ä' => 'Ae',
'Ö' => 'Oe',
'ä' => 'ae',
'è' => 'e',
'é' => 'e',
'ö' => 'oe',
'ü' => 'ue',
'Ü' => 'Ue',
'ß' => 'ss',
' ' => '_',
'€' => 'EUR',
);
$file003 = strtr($file_name, $replace_characters);

// alle anderen Zeichen verwerfen
    $file_name = preg_replace('#[^a-zA-Z0-9_.-]#', '-', $file003);

    //Filename Cleanup ENDED


with this addition i solved all user problems with uploading files with german umlauts and then not showing then...

my problem.

If i use your great script, i have to insert the replacement in the existing section in the file upload.php.

if found that the section:
Code: Select all
$filename = $_FILES['upfile']['name'];
$filename = str_replace("'",'',"$filename");
$filename = str_replace("&",'_',"$filename");
$filename = str_replace("!",'_',"$filename");
$filename = str_replace("@",'_',"$filename");
$filename = str_replace("#",'_',"$filename");
$filename = str_replace("$",'_',"$filename");
$filename = str_replace("%",'_',"$filename");
$filename = str_replace("^",'_',"$filename");
$filename = str_replace("*",'_',"$filename");
$filename = str_replace("(",'_',"$filename");
$filename = str_replace(")",'_',"$filename");
$filename = str_replace("-",'_',"$filename");
$filename = str_replace("+",'_',"$filename");
$filename = str_replace("=",'_',"$filename");
$filename = str_replace("|",'_',"$filename");
$filename = str_replace(" ",'',"$filename");


is only active when uploading via html form.
when i upload via flash, then this does not work.

is there a way to handle this replacement table at flash uploading too?


Hmm.. Are you basically saying that STR_REPLACE is not taking action when uploaded by flash?
PeterS
Global Moderator
 
Posts: 159
Joined: Mon Feb 21, 2011 4:58 am

Re: german umlauts handling...

Postby tom » Sun Apr 17, 2011 6:35 pm

PeterS wrote:Hmm.. Are you basically saying that STR_REPLACE is not taking action when uploaded by flash?


yes!
tom
Standard Member
 
Posts: 8
Joined: Sat Apr 16, 2011 2:04 pm

Re: german umlauts handling...

Postby SamEA » Sun Apr 17, 2011 6:53 pm

tom wrote:
PeterS wrote:Hmm.. Are you basically saying that STR_REPLACE is not taking action when uploaded by flash?


yes!


Working perfectly fine as shown in the below image:

Click here to view image.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: german umlauts handling...

Postby tom » Tue Apr 19, 2011 7:03 pm

where is my reply???
tom
Standard Member
 
Posts: 8
Joined: Sat Apr 16, 2011 2:04 pm

Re: german umlauts handling...

Postby tom » Tue Apr 19, 2011 7:04 pm

this works
Code: Select all
$filename = $_FILES['upfile']['name'];
if ($_GET['method'] == "flash") $filename = utf8_decode($filename);


it seems in my environment flash based uploads are UTF8
html uploads are standard ascii
tom
Standard Member
 
Posts: 8
Joined: Sat Apr 16, 2011 2:04 pm


Return to Bug Tracker

Who is online

Users browsing this forum: No registered users and 7 guests

cron