[Geomoose-users] Search Capability For A Layer with Portuguese special characters

Jim Klassen klassen.js at gmail.com
Thu Mar 13 15:02:22 PDT 2014


I tested replacing escape() with encodeURIComponent() and there is an issue.

While more correct, it does break existing services (such as select.php)
because encodeURIComponent() escapes more characters than escape().  In
this particular case the "/" being replaced by "%2F" in select_layer is
causing select.php to return 500.

Clearly, the select.php (and other services included in the GeoMoose
Demo) should be updated to call urldecode() where appropriate.  My
concern is what this change may break existing custom services.

(And a second concern, the select.php service should probably validate
its parameters instead of dieing with a 500).

I have a patch for Service.js and untested patches for the PHP services
if someone wants them as a starting point.

Jim

On 03/13/2014 12:29 PM, Jim Klassen wrote:
> +1 on replacing escape() with encodeURIComponent() as escape() is
> deprecated and doesn't always handle Unicode correctly [1].
>
> I am not up on the PHP services, but I have to call URI.unescape() on
> the parameters in my Ruby services so calling urldecode() in PHP makes
> some sense.
>
> Any objections?
>
> [1] http://www.w3schools.com/jsref/jsref_escape.asp
>
> On 03/13/2014 12:13 PM, Michał Chmielewski wrote:
>> Hi Andr?,
>>
>> If I understand correct you have a problem with special characters
>> I had the same problem with eastern europe languages.
>> My solution is to change coding: "escape" into "encodeURIComponent" in
>> Service.js
>> the easy part is to change lines with:
>> params[input_name].push( escape(input_value) );
>> into
>> params[input_name].push( escape(input_value) );
>> into
>> params[input_name].push( encodeURIComponent(input_value) );
>>
>> And the hard part, in every php file, all request change into urldecode
>> for example in identyfy.php
>> $visibleLayers = $_REQUEST['layers'];
>> into
>> $visibleLayers = urldecode($_REQUEST['layers']);
>> ...
>> $projection = $_REQUEST['projection'];
>> into
>> $projection = urldecode($_REQUEST['projection']);
>> ...
>> lot of fun ;)
>>
>> but this will make geomoose fit for all languages.
>>
>>
>> good lock
>> chmielix
>>
>>
>> On 13 March 2014 17:55, <geomoose-users-request at lists.osgeo.org
>> <mailto:geomoose-users-request at lists.osgeo.org>> wrote:
>>
>>     Send Geomoose-users mailing list submissions to
>>     geomoose-users at lists.osgeo.org <mailto:geomoose-users at lists.osgeo.org>
>>
>>     To subscribe or unsubscribe via the World Wide Web, visit
>>     http://lists.osgeo.org/mailman/listinfo/geomoose-users
>>     or, via email, send a message with subject or body 'help' to
>>     geomoose-users-request at lists.osgeo.org
>>     <mailto:geomoose-users-request at lists.osgeo.org>
>>
>>     You can reach the person managing the list at
>>     geomoose-users-owner at lists.osgeo.org
>>     <mailto:geomoose-users-owner at lists.osgeo.org>
>>
>>     When replying, please edit your Subject line so it is more specific
>>     than "Re: Contents of Geomoose-users digest..."
>>
>>
>>     Today's Topics:
>>
>>     1. Search Capablility For A Layer with Portuguese special
>>     characters (Andr? Barriguinha)
>>
>>
>>     ----------------------------------------------------------------------
>>
>>     Message: 1
>>     Date: Thu, 13 Mar 2014 16:55:35 +0000
>>     From: Andr? Barriguinha <andrebarriguinha at agriciencia.com
>>     <mailto:andrebarriguinha at agriciencia.com>>
>>     To: Dan Little <theduckylittle at gmail.com
>>     <mailto:theduckylittle at gmail.com>>
>>     Cc: GeoMOOSE Users List <geomoose-users at lists.osgeo.org
>>     <mailto:geomoose-users at lists.osgeo.org>>
>>     Subject: [Geomoose-users] Search Capablility For A Layer with
>>     Portuguese special characters
>>     Message-ID: <5321E307.4000509 at agriciencia.com
>>     <mailto:5321E307.4000509 at agriciencia.com>>
>>     Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>>
>>     Yes UTF-8
>>
>>     You can see the interface here although in Portuguese:
>>
>>     http://agriciencia.servehttp.com:1024/riplante/riplante.html
>>
>>     I have also the same issues in the identify tool. If i use a shapefile
>>     and read directly from the table stored in a folder it doesnt
>>     work. If i
>>     put them in PostGIS it reads ok and all the special characters are
>>     identified.
>>
>>     Regards
>>
>>     Andr?
>>     Untitled Document
>>
>>
>>     Em 13-03-2014 16:38, Dan Little escreveu:
>>     > Hi Andr?,
>>     >
>>     > This is an issue with encodings and PHP that I need to work out. I
>>     > keep forgetting to do it. We've ran into this problem with Russian,
>>     > Turkish, and German. I can probably create a test case for German.
>>     > Are you using UTF-8?
>>     >
>>     >
>>     > On Wed, Mar 12, 2014 at 1:01 PM, Andr? Barriguinha
>>     > <andrebarriguinha at agriciencia.com
>>     <mailto:andrebarriguinha at agriciencia.com>
>>     > <mailto:andrebarriguinha at agriciencia.com
>>     <mailto:andrebarriguinha at agriciencia.com>>> wrote:
>>     >
>>     > I'm having trouble setting up the search to a layer when I use
>>     > characters like ? ou ?
>>     >
>>     > Basicaly writen in Portuguese with some special characters.
>>     >
>>     > The layer is in a PostGIS database and works fine if I search
>>     > words with no special characters
>>     >
>>     > Iam using the comparitor like-icase
>>     >
>>     > Regards
>>     >
>>     > Andr? Barriguinha
>>     >
>>     >
>>     > --
>>     >
>>     > <http://www.agriciencia.com/> *Andr? Barriguinha*
>>     > */Agri-Ci?ncia, Consultores de Engenharia, Lda./*
>>     > <http://www.agriciencia.com>
>>     > Rua dos Lus?adas, 52 - 1?
>>     > 1300-372 LISBOA
>>     > PORTUGAL
>>     > *E-mail: *andrebarriguinha at agriciencia.com
>>     <mailto:andrebarriguinha at agriciencia.com>
>>     > <mailto:andrebarriguinha at agriciencia.com
>>     <mailto:andrebarriguinha at agriciencia.com>>
>>     > *Telef: *+(351) 213 649 625
>>     > *Telm:* +(351) 914 155 278 <tel:%2B%28351%29%20914%20155%20278>
>>     > *Fax:* +(351) 213 649 625 <tel:%2B%28351%29%20213%20649%20625>
>>     >
>>     >
>>     > _______________________________________________
>>     > Geomoose-users mailing list
>>     > Geomoose-users at lists.osgeo.org
>>     <mailto:Geomoose-users at lists.osgeo.org>
>>     <mailto:Geomoose-users at lists.osgeo.org
>>     <mailto:Geomoose-users at lists.osgeo.org>>
>>     > http://lists.osgeo.org/mailman/listinfo/geomoose-users
>>     >
>>     >
>>
>>     -------------- next part --------------
>>     An HTML attachment was scrubbed...
>>     URL:
>>     <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20140313/61d0b767/attachment.html>
>>     -------------- next part --------------
>>     A non-text attachment was scrubbed...
>>     Name: not available
>>     Type: image/jpeg
>>     Size: 18296 bytes
>>     Desc: not available
>>     URL:
>>     <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20140313/61d0b767/attachment.jpe>
>>
>>     ------------------------------
>>
>>     _______________________________________________
>>     Geomoose-users mailing list
>>     Geomoose-users at lists.osgeo.org <mailto:Geomoose-users at lists.osgeo.org>
>>     http://lists.osgeo.org/mailman/listinfo/geomoose-users
>>
>>     End of Geomoose-users Digest, Vol 33, Issue 5
>>     *********************************************
>>
>>
>>
>>
>> -- 
>> Michał Chmielewski
>> mich.chmielewski at gmail.com <mailto:mich.chmielewski at gmail.com>
>>
>>
>> _______________________________________________
>> Geomoose-users mailing list
>> Geomoose-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/geomoose-users



More information about the Geomoose-users mailing list