umlaut doesn't work with HTTP-authetication
Moderator: General Moderators
-
Sternchen-Barbara
- Forum Newbie
- Posts: 5
- Joined: Mon May 08, 2006 4:33 am
umlaut doesn't work with HTTP-authetication
Hello,
since I've changed my login-system into one with HTTP-authentication I can't user usernames or passwords with an umlaut although I've UTF-8 encoding on the website and I'm sending header('Content-Type: text/html; charset=utf-8');
Is there a solution or will I have to forbid using an umlaut?
Thanks!
since I've changed my login-system into one with HTTP-authentication I can't user usernames or passwords with an umlaut although I've UTF-8 encoding on the website and I'm sending header('Content-Type: text/html; charset=utf-8');
Is there a solution or will I have to forbid using an umlaut?
Thanks!
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
-
Sternchen-Barbara
- Forum Newbie
- Posts: 5
- Joined: Mon May 08, 2006 4:33 am
I'm pretty sure that there is no problem with the database because it works with Opera, but not with other browsers 
And yes, the database is also encoded with UTF-8... that's why you can change the password or name but afterwords login isn't possible anymore (except with Opera), it's like typing in the wrong data.
And yes, the database is also encoded with UTF-8... that's why you can change the password or name but afterwords login isn't possible anymore (except with Opera), it's like typing in the wrong data.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Is data being encoded somewhere along the line - perhaps the umlaut is being url encoded or similar and its not being translated back for a valid comparison? Echo the value being used in DB queries to see what it actually is (see the HTML source since the browser view won't show entities literally - if any exist). See Roja's suggestion on checking variables as they move between browser->PHP->DB and back...
-
Sternchen-Barbara
- Forum Newbie
- Posts: 5
- Joined: Mon May 08, 2006 4:33 am
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Question marks typically mean something along the line did not understand the umlaut character and replaced it as a result - common issue with UTF-8 characters being treated as ASCII... Something along the line is passing the umlaut off as ASCII or iso-8859-1 and it's being wrongly interpreted. Assuming the output is unchanged (no PHP string manipulation) then that leaves the browser, and your webserver. What's Apache serving in its header's?
-
Sternchen-Barbara
- Forum Newbie
- Posts: 5
- Joined: Mon May 08, 2006 4:33 am
Not the server is the problem because in this case it wouldn't work with Opera but it does.
Link for trying:
http://lamp2.fh-stpoelten.ac.at/~tm021032/umlaut.php
username: ö
password what ever you want
Link for trying:
http://lamp2.fh-stpoelten.ac.at/~tm021032/umlaut.php
username: ö
password what ever you want
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
I'm not too familiar with headers - but the basic auth scheme works from my end (Firefox - using LiveHTTPHeaders extension). The umlaut character and a password are being correctly concatenated and encoded via base64 by the browser. The correct base64 value is passed to your server - from there... Whatever your server does.Authorization: Basic 9jptYXVncmlt
I just keep getting the unauthorised reponse...
Any chance you can post code which could be tested?HTTP/1.x 401 Unauthorized
-
Sternchen-Barbara
- Forum Newbie
- Posts: 5
- Joined: Mon May 08, 2006 4:33 am
Umm, from the page posted:
Notice that the username is NOT the single character string you posted here on the forums. When using the two characters above, it worked fine.
Oddly, when accessing it after authentication, it does show the username as the single character with umlaut.
Very bizarre behavior. Really not sure of the cause. Its not the header issue I originally suspected either. (In some cases, apache sends a encoding type, and when it conflicts with the header encoding type, odd things happen. But thats not happening here).
Code: Select all
if ($_SERVER['PHP_AUTH_USER']!='ö') {Oddly, when accessing it after authentication, it does show the username as the single character with umlaut.
Very bizarre behavior. Really not sure of the cause. Its not the header issue I originally suspected either. (In some cases, apache sends a encoding type, and when it conflicts with the header encoding type, odd things happen. But thats not happening here).