View Issue Details

IDProjectCategoryView StatusLast Update
0008091mantisbtcsvpublic2009-06-26 12:07
Reportermalaussena Assigned Tovboctor  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.7 
Fixed in Version1.1.0a4 
Summary0008091: csv_export doesn't work when project name contains accentuated characters
Description

In french, for instance, project names often uses accentuated characters.
In these cases, csv_export doesn't work.

I patched it using ths function :

<?php
function cp1250_to_utf2($text){
$dict = array(chr(225) => 'a', chr(228) => 'a', chr(232) => 'c', chr(239) => 'd',
chr(233) => 'e', chr(236) => 'e', chr(237) => 'í', chr(229) => 'l', chr(229) => 'l',
chr(242) => 'n', chr(244) => 'o', chr(243) => 'o', chr(154) => 's', chr(248) => 'r',
chr(250) => 'u', chr(249) => 'u', chr(157) => 't', chr(253) => 'y', chr(158) => 'z',
chr(193) => 'A', chr(196) => 'A', chr(200) => 'C', chr(207) => 'D', chr(201) => 'E',
chr(204) => 'E', chr(205) => 'I', chr(197) => 'L', chr(188) => 'L', chr(210) => 'N',
chr(212) => 'O', chr(211) => 'O', chr(138) => 'S', chr(216) => 'R', chr(218) => 'U',
chr(217) => 'U', chr(141) => 'T', chr(221) => 'Y', chr(142) => 'Z',
chr(150) => '-');
return strtr($text, $dict);
}
?>

And modifying :

header( 'Content-Type: text/plain; name=' . <b>cp1250_to_utf2( $t_filename )</b> );

and :

header( 'Content-Disposition: attachment; filename="' . cp1250_to_utf2( $t_filename ) . '"' );

Maybe it's not the good patch to apply but it works.

Please, find the rigth way to fix this.

TagsNo tags attached.

Relationships

related to 0006217 closedvboctor [all lang] Wrong fIlename on download 

Activities

malaussena

malaussena

2007-06-22 03:12

reporter   ~0014798

Maby be related to 0006217, but I find my fix better than urlencode (names are kept, only accents are removed).

vboctor

vboctor

2007-06-22 23:49

manager   ~0014806

Fixed using urlencode() to be consistent with other fixes lately applied to similar download pages.

malaussena

malaussena

2007-11-16 09:17

reporter   ~0016232

Hi
I don't know what has happened, but the fix (urlencoding) seems not working any more when using Firefox.

Downloading still ok with IE, but no more with Firefox when using accentuated characters.

It's ok when I modify file_download.php and remove the test on 'MSIE'.

Any idea ?

malaussena

malaussena

2007-11-16 09:28

reporter   ~0016233

Oops... I made a mistake.
My problem occurs only when trying to download an attached file, not when using export...

Do I need to create another bug ?

malaussena

malaussena

2007-11-16 09:31

reporter   ~0016234

For the export problem, urlencode is always used.
So it's still ok.

For file_download.php we probably should do the same.
(Probably something has changed in Firefox).

vboctor

vboctor

2007-11-16 10:24

manager   ~0016236

I think the problem is that in csv_export we always URL encode, but in Firefox we only urlencode when using IE.

In file_download.php, replace:

Added Quotes (") around file name. Also in case of IE url encode the filename

# firefox seems to do fine without the urlencoding.  I am not sure if always
# urlencoding is an issue.
if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
    header( 'Content-Disposition:' . $t_disposition . ' filename="' . urlencode($t_filename) . '"' );
} else {
    header( 'Content-Disposition:' . $t_disposition . ' filename="' . $t_filename . '"' );
}

With:
header( 'Content-Disposition:' . $t_disposition . ' filename="' . urlencode($t_filename) . '"' );

Let me know, how you go.

malaussena

malaussena

2007-11-16 10:29

reporter   ~0016237

It's exactly what I did (and was saying in 0008091:0016232).

Only leaving :

header( 'Content-Disposition:' . $t_disposition . ' filename="' . urlencode($t_filename) . '"' );

in file_download.php solves the problem with Firefox.

vboctor

vboctor

2007-11-16 10:41

manager   ~0016239

The fix for the file_download / firefox case is now tracked by 0008589.