Forum Moderators: phranque

Message Too Old, No Replies

Unicode problem on a localhost server

Entered URL is converted, running on Wampserver stack

         

Waher

7:59 am on Apr 14, 2010 (gmt 0)

10+ Year Member



I am using Wampserver for my Windows Apache-PHP-MySQL stack. The file accessed has a header that defines it as utf-8, meta tag in HTML also defines it as utf-8.

My best guess so far is that it has something to do with Apache. Searching through Google was of little help thanks to rather common keywords used. When I enter:

[protocol]://localhost/originnode/?test=õäöü

.. the browser converts the URL to ..

[protocol]://localhost/originnode/?test=%F5%E4%F6%FC

.. and same applies to $_GET string returned to the document. Now I know that a hosting service I am using has no such problem, the same file functions as expected on one of the virtualhosts I am renting. This only happens on localhost.

Any solution to this problem? Where to look?

One of the threads I found from Google mentioned the value 'AddDefaultCharset', which is not defined in my install. Language configuration does have AddCharsets (which does include utf-8) as well as languages, but that value was not defined. When I defined it myself as "AddDefaultCharset utf-8" in the end and restarted, nothing changed and the URL was still convered.

Any help would be appreciated, thanks!

jdMorgan

1:05 pm on Apr 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ugh. These encoding problems are always a headache. Make sure also that your browser is not set to force unicode conversion of requested URLs.

In the end, the only way to assure correct operation for all users with all browser settings will be to adapt your scripts to handle this case as well as the expected "not-encoded" case. From that viewpoint, this is actually a good opportunity to get that working before you continue trying to correct the problem in the server config. Making the scripts properly handle encoded query strings can usually be done quite easily using the "urldecode" function of your scripting language.

Also, be sure to delete your browser cache after making any server-side changes (any config settings or script changes). Otherwise, your browser may show you stale previously-cached pages and server responses.

Jim

Waher

1:30 pm on Apr 14, 2010 (gmt 0)

10+ Year Member



Thanks for the suggestions, much appreciated :) Still no real solution though, a user from another forum told me that this is very likely a linux-windows issue and that in the case of Windows I simply have to detect the environment and parse-convert the entered URL.

Not going to give up yet though.

jdMorgan

2:16 pm on Apr 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, the urldecode() and urlencode() functions may be useful. (I'm not sure I spelled those right, but these functions exist in PHP and PERL).

Jim