Re: Uploading files with speical characters....
> I work on s system, which is based on one.com (Denmark) - and used
> elsewhere, in my case in the baltics.
> When uploading files, there is problem with Lativian characters - the
> e with overscore (e with a line above; ē )
>
> The problem is, that when uploading, it changes the "e" to the html
> code:
>
> echo "\r\n10- ".$_FILES["newfile_$i"]['name']."<br>";
> result:
> whatever_ē.pdf
<snip>
>
> The file header reads:
> <meta http-equiv="content-type" content="text/html;
> charset=iso-8859-1">
>
> My problem - the system is in use in quite some places, to I cannot
> rule any characters out.... (there are Danish, Swedish, Norweigian,
> Estonia and German files in the system - basically Baltic,
> Scandinavian and wharver charset they are using in Germany) . The best
> I can think of now is entity decode, and the replace all other &#__;
> which underscore or something....
>
> Any ideas anyone?
Are you sure that all the necessary characters are in iso-8859-1? For
example, the Euro sign is not. For international sites, I'd use utf-8.
For any character that is not in iso-8859-1, there is little alternative
but to change it into an HTML entity.
A lot depends on your operating system, as you are dealing with file
names. If your OS uses iso-8859-1 file names, you are stuck with it and
can use a whitelist of acceptible characters. The rest can be replaced
by an underscore, for example. This is even a good idea for
non-international sites, as some characters have special meaning on
different operating systems.
Good luck!
|