[ka-Map-users] Re: Error with the php module in Mapserver when using Spanish

Javier Pascual Herranz javier.pascual at radmas.com
Mon Nov 19 13:51:09 EST 2007


Hi!

Thank you for your time

This time I will try to tell you better which is our situation and which is
our
Problem with PHP&Mapserver and Spanish characters


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 ¿?

Cheers
Javier



Sacha & Daniel wrote:

>hi Javier,
>
>i think this problem could happen with ANY special characters in a
>URL. it's likely not limited to spanish ... see
>http://www.w3schools.com/tags/ref_urlencode.asp or do a google search
>on "URL encoding"
>
>you will just have to make sure that your application passes the
>correct URL-encoded strings in the request to Mapscript.
>
>sacha

>Javier,
>
>This doesn't seem to be a MapServer-specific problem.
>
>I did a quick Google for the error message that you got in the Apache 
>error_log and it seems that this has happened to others when they tried 
>to pass accented characters in a URL without URL-encoding them like you 
>did. The solution seems to be to properly url-encode the values as you did.
>
>Daniel


Javier Pascual Herranz wrote:
>> Hi all,
> 
> I have an error with the php module in Mapserver when using Spanish
> characters.
> 
> Im gone try to tell you with detail which is our situation and which is
our
> problem
> 
> If I do the following consultation in Internet Explorer:  
> 
>
http://localhost/radgis/tools/search/ConsultaGeneral.php?tipoVia=Todas&lette
> rs=caq  
> 
> I receive the following error:
> 
> 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. 
> 
> 
> If I do the same consultation from FireFox the consultation transforms
into:
>
http://localhost/radgis/tools/search/ConsultaGeneral.php?tipoVia=Todas&lette
> rs=ca%F1  
> And returns a correct result.
> 
> 
> The file of log of Apache shows the following information when I do the
> consultation with Internet Explorer. 
> 
> (70008)Partial results are valid but processing is incomplete: utf8 to
> ucs2 conversion failed on this string:
> REDIRECT_QUERY_STRING=tipoVia=Todas&letters=ca\xf1 
> [Fri Nov 16 09:51:47 2007] [error] [client 127.0.0.1] (70008)Partial
> results are valid but processing is incomplete: couldn't create child
> process: 70008: php-cgi.exe 
> [Fri Nov 16 09:51:47 2007] [error] [client 127.0.0.1] (70008)Partial
> results are valid but processing is incomplete: couldn't spawn child
> process: C:/ms4w/Apache/cgi-bin/php-cgi.exe 
> 
> 
> Do you know any solution to use special Spanish characters with PHP
request?
> 
> Thank you for your time 
> Cheers
> Javier
> 






More information about the ka-Map-users mailing list