|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi
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 Even those do not : echo "\r\n11- ".html_entity_decode($_FILES["newfile_$i"] ['name'])."<br>"; echo "\r\n12- ".stripslashes($_FILES["newfile_$i"]['name'])."<br>"; 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? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
> 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! |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
jodleren escribió:
> 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 I haven't found the PHP manual page where such feature is documented but a few tests have shown that this behaviour changes depending on the charset parameter of the "Content-Type" HTTP header; even if I don't set an actual HTTP header and I just use a <meta> tag: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> With a packet sniffer I've determined that it's not the browser who changes it. If you write into a file the entities are still there, so it doesn't seem to be an Apache feature. It's really weird. If it's not feasible to change your encoding to UTF-8, well, I don't know what you can do... -- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://bits.demogracia.com -- Mi web de humor al baño María: http://www.demogracia.com -- |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 17 Jun, 11:46, "Álvaro G. Vicario"
<alvaroNOSPAMTHA...@demogracia.com> wrote: > jodleren escribió: > > > 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 > > I haven't found the PHP manual page where such feature is documented but > a few tests have shown that this behaviour changes depending on the > charset parameter of the "Content-Type" HTTP header; even if I don't set > an actual HTTP header and I just use a <meta> tag: > > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> > > With a packet sniffer I've determined that it's not the browser who > changes it. If you write into a file the entities are still there, so it > doesn't seem to be an Apache feature. It's really weird. > > If it's not feasible to change your encoding to UTF-8, well, I don't > know what you can do... > > -- > --http://alvaro.es- Álvaro G. Vicario - Burgos, Spain > -- Mi sitio sobre programación web:http://bits.demogracia.com > -- Mi web de humor al baño María:http://www.demogracia.com > -- I have the same problem but with uploading excel files to mysql 5. It doesn't matter if I use UTF-8 or iso-8859-1 and uploading the trademark symbol. htmlspecialchars() or htmletities() doesn't ? |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Jun 17, 5:31Âpm, matech <robert.mat...@hotmail.co.uk> wrote:
> On 17 Jun, 11:46, "Ãlvaro G. Vicario" > > > > > > <alvaroNOSPAMTHA...@demogracia.com> wrote: > > jodleren escribió: > > > > 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 > > > I haven't found the PHP manual page where such feature is documented but > > a few tests have shown that this behaviour changes depending on the > > charset parameter of the "Content-Type" HTTP header; even if I don't set > > an actual HTTP header and I just use a <meta> tag: > > > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> > > > With a packet sniffer I've determined that it's not the browser who > > changes it. If you write into a file the entities are still there, so it > > doesn't seem to be an Apache feature. It's really weird. > > > If it's not feasible to change your encoding to UTF-8, well, I don't > > know what you can do... > > > -- > > --http://alvaro.es-Ãlvaro G. Vicario - Burgos, Spain > > -- Mi sitio sobre programación web:http://bits.demogracia.com > > -- Mi web de humor al baño MarÃa:http://www.demogracia.com > > -- > > I have the same problem but with uploading excel files to mysql 5. It > doesn't matter if I use UTF-8 or iso-8859-1 and uploading the > trademark symbol. htmlspecialchars() or htmletities() doesn't ?- Hidequoted text - I tried some of these, no luck. I made a replace for known letters ( e.g. ē => e ) end for the rest I just replace them with _ (underscore) That way I can avoid any problems. I am just wondering when they start using russian letters in filenames... hope they wont /S |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Jun 17, 11:20 am, jodleren <sonn...@hot.ee> wrote:
> Hi > > 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 > > Even those do not : > echo "\r\n11- ".html_entity_decode($_FILES["newfile_$i"] > ['name'])."<br>"; > echo "\r\n12- ".stripslashes($_FILES["newfile_$i"]['name'])."<br>"; > > 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? You can try iconv on file name, like iconv('UTF-8', 'iso-8859-1// TRANSLIT', $s); |
|
![]() |
| Outils de la discussion | |
|
|