Re: Charset and filenames
| From: | Gustavo Lopes | Date: | Tue, 01 Mar 2005 03:04:32 +0000 |
| Subject: | Re: Charset and filenames | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209658@lists.php.net to get a copy of this message | ||
"Jochem Maas" <jochem@iamjochem.com> wrote in message
news:4223C773.1020303@iamjochem.com...
> Gustavo Lopes wrote:
>> I appreciate your reply but I'm not satisfied.
>>
>> "Richard Lynch" <ceo@l-i-e.com> wrote in message
>> news:3535.66.99.91.45.1109635746.squirrel@www.l-i-e.com...
>>
>>>Gustavo Lopes wrote:
>>>
>>>>I'm building a script that makes a list of files available in a
>>>>directory
>>>>(PHP 4.3.10, Apache 2.0.53, windows, NTFS file system). The XHTML is
>>>>served
>>>>as ISO-8859-1. However, I'm having trouble in generating correct links
>>>>for
>>>>files with accents, etc.
>>>>The problem is rawurlencode() appears to convert strings by translating
>>>
>>>I don't suppose there's any way to just rename the file...
>>
>> I don't want to rename any file, just change a link destination by
>> encoding
>> the filename differently.
>>
>>
>>>You may be able to do the urlencode() and then un-do the %3E back to, err
>>>whatever it was.
>>
>> What? Where did you get that %3E from?
>
> I think he was just typing off memory and quoted a different encoded
> char...
> my encoding battles are always a trail and error affair until 'it'
> does what I want... but maybe these 2 functions may help you:
>
> http://nl2.php.net/manual/en/function.utf8-encode.php
> http://nl2.php.net/manual/en/function.utf8-decode.php
>
>
>>
>> Gustavo Lopes
>>
Thank you, utf8_encode() is in fact the solution to my problem. A function
$s -> htmlentities(rawurlencode(utf8_encode($s))) seems to be able to
produce correct output for every file.
Gustavo Lopes