Author |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Wed 14 Dec '11 11:09 Post subject: Get problem of URL with special german characters |
|
|
I have an URL of the form "http://localhost/path/filename.html"
The file name contains special national german characters. I URLEncode the file name in my Java app using UTF-8.
When I try to read the URL in browsers I get web server errors 404/500...
The html file is not in the www but on my local machine in the DocumentRoot directory.
If the html file name contains only ASCII chars the browser shows the content correctly - no read error.
Is there a misconfiguration of the Apache Server on my Windows 7 system ?
Thanks for any help/hint/solution. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Wed 14 Dec '11 14:38 Post subject: |
|
|
Java App? Are you using Tomcat and or httpd apache?
I tried a file with the name öääüß.txt and that works fine with httpd apache
--- edit ---
I tried
Code: |
<a href="öääüß.txt">öääüß.txt</a>
<br />
and<br >
<a href="öääüß.txt">öääüß.txt</a>
|
Last edited by James Blond on Sat 17 Dec '11 22:22; edited 1 time in total |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Wed 14 Dec '11 18:11 Post subject: |
|
|
James Blond wrote: | Java App? Are you using Tomcat and or httpd apache?
I tried a file with the name öääüß.txt and that works fine with httpd apache
--- edit ---
I tried
Code: |
<a href="öääüß.txt">öääüß.txt</a>
<br />
and<br >
<a href="öääüß.txt">öääüß.txt</a>
|
|
I run httpd apache on port 80 and tomcat on 8080.
I have a Java Applet and call the browse() method.
As parameter I give the mentioned URL.The method calls the standard browser. The browser shows the error.
I want to test your HTML snippet : where do I put the
öääüß.txt test file ? Simply in DocumentRoot ?
EDIT : I tested your code. It works with .txt extension. But when I change to .html extension and
enter http://localhost/öääüß.html I get this error
Dieser Fehler (HTTP 500 Interner Serverfehler) bedeutet, dass die Website, die Sie besuchen möchten, ein Serverproblem hat, durch das die Anzeige der Webseite verhindert wird.
Weitere Informationen über HTTP-Fehler erhalten Sie in der Hilfe. |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Wed 14 Dec '11 21:02 Post subject: |
|
|
Hm, I made some further tests.
I not only have an applet but also a servlet which runs on Tomcat (!) : and now I see that I cant connect to the url on the Tomcat side !!!
So your first question was well posed and you were
right.
Perhaps I have to go to a Tomcat forum with my problem or do you know whether Tomcat can't deal with these kind of url ? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Wed 14 Dec '11 23:40 Post subject: |
|
|
500 Error means: misconfigured config. More details in the error log? Or if it was in tomcat that log file. If I remember correctly than catalia.out
How do you connect tomcat to apache? Over mod_jk or over mod_proxy_ajp?
Did you place the the öääüß.txt into apache root or tomcat root? |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Thu 15 Dec '11 11:59 Post subject: |
|
|
James Blond wrote: | 500 Error means: misconfigured config. More details in the error log? Or if it was in tomcat that log file. If I remember correctly than catalia.out
How do you connect tomcat to apache? Over mod_jk or over mod_proxy_ajp?
Did you place the the öääüß.txt into apache root or tomcat root? |
In the error logs of my Apache or tomcat I dont find any understandable or informative lines.
What does mod_jk or mod_proxy_ajp mean ? I dont find these names in configuration file(s) of Apache or Tomcat...
I put the öääüß.txt in Apache root directory.
I also put a file named öääüß.html and oeaeaeuess.html in there.
Then I get in the browser :
1. http://localhost/öääüß.txt - the html source code is shown
2. http://localhost/öääüß.html - 500 server error
3. http://localhost/oeaeaeuess.html - html file correctly rendered. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Thu 15 Dec '11 16:13 Post subject: |
|
|
The question about mod_jk and mod_proxy_ajp was because I thought you are using apache as a front end server before Tomcat
internet<--->apache<--->tomcat
Since you do know nothing about that I doubt you do that... do you?
Since you don't find the error, you may post the error log at http://pastebin.de/ and than here the url.
Do you use apache out of the box or what did you change form the config. Also I'd like to know which version you are using and where you downloaded it.
However, only the .html extension seem to cause trouble and not the Umlauts in the URL. Did you associate any handler to .html extension? |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Thu 15 Dec '11 17:05 Post subject: |
|
|
James Blond wrote: | The question about mod_jk and mod_proxy_ajp was because I thought you are using apache as a front end server before Tomcat
internet<--->apache<--->tomcat
Since you do know nothing about that I doubt you do that... do you?
Since you don't find the error, you may post the error log at http://pastebin.de/ and than here the url.
Do you use apache out of the box or what did you change form the config. Also I'd like to know which version you are using and where you downloaded it.
However, only the .html extension seem to cause trouble and not the Umlauts in the URL. Did you associate any handler to .html extension? |
1. I dont know how to use Apache as a front-end.
In the Tomcat start protocol I find this message :
Initializing ProtocolHandler "ajp-bio-8009"
Deal this with mod_proxy_ajp ?
BTW : I find in conf file this comment line :
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
2. I use Apache almost out of the box. Its Apache 2.2. I got it from the Apache Home page. I made some change concerning PHP in the conf file and once added
these lines :
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Otherwise no AddHandler directives !
3. You are probably right : the Umlaute are not the reason as I found an example with Umlaute and an .xml extension which works fine !!!
What do you mean by handler ? How to implemnet in conf file ?
4. Let me send you one error message from the Apache error log. In the browser is sent :
http://localhost/HTMLLinks20111105Fünf%20Wochen%20Psychiatrie.html
This error appears :
[Thu Dec 15 15:21:16 2011] [error] [client 127.0.0.1] script 'D:/WebSite/HTMLLinks20111105F\xc3\xbcnf Wochen Psychiatrie.html' not found or unable to stat
- no / between HTML and Links and the file name !!!
- ü is encoded to c3 bc
- no %20 any more but blanks |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Thu 15 Dec '11 21:34 Post subject: |
|
|
Here two images from a run of a Java programmed browser which obviously has similar problems :
[img]http://www.filedropper.com/screensnaperimage1[/img]
[img]http://www.filedropper.com/screensnaperimage2[/img] |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Thu 15 Dec '11 23:33 Post subject: |
|
|
Quote: |
[Thu Dec 15 15:21:16 2011] [error] [client 127.0.0.1] script 'D:/WebSite/HTMLLinks20111105F\xc3\xbcnf Wochen Psychiatrie.html' not found or unable to stat
|
script ... not found or unable to stat
This means there must be a handler or something that does something with .html files or in that directory.
Yepp with mod_proxy_ajp you can set apache in front of tomcat. See the german link http://de.wikipedia.org/wiki/Apache_JServ_Protocol |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Fri 16 Dec '11 10:02 Post subject: |
|
|
Since it seems to be an script error I have the strange feeling it might belong to the php setup you made in httpd.conf, so you may post that as well. |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Fri 16 Dec '11 13:07 Post subject: |
|
|
Sorry, its a long time since I installed Apache and Tomcat on my machine. Now I dont find the PHP additions I once made - perhaps in a former version of Apache.
But I find this line which could be interesting if your hint is right :
AddType application/x-httpd-php .php .html
EDIT : here I found my PHP modifications !!!
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Fri 16 Dec '11 14:15 Post subject: |
|
|
wkt wrote: |
AddType application/x-httpd-php .php .html
|
OK, you associated .html extension with the php handler PHP parses .html files.
Usualy if a file can't not be found there will be a 404 error, but since it is handled by the external module, php in this case, it causes the 500 error.
So now I try to figure out why apache seems to have trouble finding that file. Which is weired since the finds the same file with a different extension.
Your apache version?
PHP Version? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Fri 16 Dec '11 14:34 Post subject: |
|
|
First trial on the command line, shows why it doesn't work with fcgid which I use, cause I use apache 2.3 and there is no mod_php yet.
ü.php
Code: |
<?php
echo $_SERVER['PHP_SELF'];
?>
|
Code: |
D:\Apache23\php538>php.exe D:\Apache23\htdocs\ü.php
D:\Apache23\htdocs\³.php
D:\Apache23\php538>
|
as you can see php itself returns the umlaut from the file system like in old DOS days. So I think it is not possible to have PHP pared files with umlauts in the filename. |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Fri 16 Dec '11 16:14 Post subject: |
|
|
Grüße nach Hamburg. Habe wohl mit Deinen Kenntnissen das große Los gezogen !
Versionen : Apache 2.2
PHP 5 ( keine Info über etwaige Sub-Versionen )
PHP sagt mir wenig - hatte es mal der Vollständigkeit halber installiert...
Heißt das jetzt ich muß nur .html in der Zeile
AddType application/x-httpd-php .php .html
entfernen ??? Weiß nicht warum es da steht und ob das die Regel ist bzw. was die Entfernung für Nachteile/Fehler mit sich bringen würde. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Fri 16 Dec '11 17:47 Post subject: |
|
|
Just to be fair to the others I answer in english.
Yes and no
If you wanna use some php some kinda day
change
Code: |
AddType application/x-httpd-php .php .html
|
to
Code: |
AddType application/x-httpd-php .php
|
else just remove it and also remove
Code: |
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
|
Quote: |
Weiß nicht warum es da steht und ob das die Regel ist bzw. was die Entfernung für Nachteile/Fehler mit sich bringen würde.
|
The PHPIniDir tells where to find the php.ini file
LoadModule php5_module ... load php as module into apache
AddType application/x-httpd-php .php tells apache that the .php extension shall be handled by the php module. And you can add as many extensions as you like. In your case there was also .html added.
Grüße aus dem Norden, wo auch immer Du herkommst
Last edited by James Blond on Sat 17 Dec '11 22:21; edited 1 time in total |
|
Back to top |
|
wkt
Joined: 14 Dec 2011 Posts: 9
|
Posted: Fri 16 Dec '11 18:52 Post subject: |
|
|
Really great help !!!
I removed the .html and now the pages show up.
I hope you are well paid for this great discussion.
Tell your boss...
Final remark : I live in the southern part of Germany
near Heidelberg.
Thank you. Happy Christmas and "Guten Rutsch". |
|
Back to top |
|