Closed
Bug 167934
Opened 23 years ago
Closed 23 years ago
UTF-8 problem with pictures embedded in a php script serverside
Categories
(Core Graveyard :: File Handling, defect)
Tracking
(Not tracked)
VERIFIED
INVALID
People
(Reporter: hakon_, Assigned: law)
Details
I have embedded a picture in a php script in order to force the open/save
dialogue. It looks like this (the file is 'Picture.php'):
<?php
header("Content-type: image/png");
header("Content-Disposition: attachment; filename=Picture.png");
readfile('/path/to/file/Picture.png');
?>
it works fine for most filenames. But if the filename contains an accented
character or similar, like 'Picture-едж.png' - then the open/save dialoog will
display and suggest the filename 'Picture-едж.php' (which is then the name of
the php file called for) instead of 'Picture-едж.png'.
I assume this is a problem with Mozilla, not PHP?
Sorry, I can't provide a url yet...
Mozilla: 2002-09-07 ; PHP: v4.2.3
Locale is UTF-8 both on the server and the client side. Default charset in
Apache is UTF-8.
Comment 1•23 years ago
|
||
This is a problem with the fact that raw non-ascii data is not allowed in the
content-disposition header unless you use a special syntax to say what the
character encoding is. What is the exact header you send when the data is
non-ascii?
All right, I understand that it's actually an invalid bug.
Do you have some url or something where I can find info about the encoding thing?
I'd be really interested to learn. Anyway, here's how the code looks.
<?php
header("Content-type: application/x-image");
header("Content-Disposition: attachment; filename=Bild på mig.png");
readfile('/path/to/file/Picture.png'); ?>
The whitespace seems to be a non-problem, I have tried the combination of only
using '_' along with 'å' as well. However, the 'å' in this case breaks it all.
You can still download, but the suggested file name for the download dialogue
will be like 'getfile.php' instead of 'Bild på mig.png'.
Comment 3•23 years ago
|
||
See http://www.ietf.org/rfc/rfc2231.txt (and note that until bug 162765 is fixed
we won't support that syntax).
Marking invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Updated•9 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•