[ms4w-users] Error with the php module in Mapserver when using Spanish

Javier Pascual Herranz javier.pascual at radmas.com
Tue Nov 20 14:34:08 EST 2007


Hi all!


I have an error with the php module in Mapserver when using Spanish
characters.
 
I m gone try to tell you with detail which is our situation and which is our
problem



Internet Explorer – Internal Server Error (Error 500) – Spanish characters


The problem is that when I use some Spanish character in the URL to pass it
as an argument to a php document, the error 500 occurs.

The php document I use for this example is example.php:

<?php header('Content-Type: text/html; charset=ISO-8859-1'); 

	echo ("Calle: " .$_GET['calle']. " Numero: " . $_GET['numero']);

?>

It is used to show the received argument.

With the URL:

http://localhost/prueba.php?calle=mayor&numero=12

the result shows up correctly:

Calle: mayor Numero: 12

I any parameter of the consult contains a spanish character like

http://localhost/prueba.php?calle=alcalá&numero=12

the result is the following:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, admin at local.domain and inform them
of the time the error occurred, and anything you might have done that may
have caused the error.
More information about this error may be available in the server error log.
The Apache log shows the following result:

(22)Invalid argument: utf8 to ucs2 conversion failed on this string:
REDIRECT_QUERY_STRING=calle=alca\xe1l&numero=12
[Mon Nov 19 17:52:03 2007] [error] [client 127.0.0.1] (22)Invalid argument:
couldn't create child process: 22: php-cgi.exe
[Mon Nov 19 17:52:03 2007] [error] [client 127.0.0.1] (22)Invalid argument:
couldn't spawn child process: C:/ms4w/Apache/cgi-bin/php-cgi.exe

For some reason, the “strange” characters are converted from utf8 to ucs2
causing the error above.

With Firefox the consults via URL which contain spanish characters are
automatically converted to hexadecimal and the result is shown correctly:

Example.

If I consult for calle alcalá

http://localhost/prueba.php?calle=alcalá&numero=12

The Spanish characters of the consult are transformed into their
corresponding hexadecimal code

http://localhost/prueba.php?calle=alcal%E1&numero=12

At last, I installed WAMP (Windows, Apache, MySQL and PHP), made the same
tests and everything worked perfectly. 
For that reason, I believe that we have to load some extra module over the
MS4W for Apache and PHP default installation to solve this kind of error ¿?

Thank you for your time


Cheers
Javier








More information about the ms4w-users mailing list