2

I'm using CQL filter to extract certain data from my GeoServer layer.

var source = new ol.source.Vector({
        loader: function (extent, resolution, projection) {
            var url = "http://localhost/geoserver/visualization/ows?service=WFS"
                + "&version=1.1.0&request=GetFeature"
                + "&typeName=visualization:".concat(inputTable)
                + '&outputFormat=text/javascript'
                + "&format_options=callback:loadFeatures"
                + '&srsname=EPSG:3857'
                + filter;
            $.ajax({ url: url, dataType: 'jsonp', jsonp: false });
            console.log(filter);
            console.log(url);
        }
    });

Notice the filter string as the final parameter at url. If I normally input the feature name using alphabet text, it will return the result. But if I use other than alphabet (UTF-8, EUC-KR) it won't return anything.

&cql_filter=branchCode='N01821'  -> works
&cql_filter=방향='S'             -> korean word, doesn't work

If I print the URL, the Korean strings give me this error

<ows:ExceptionText>Could not parse CQL filter list. Lexical error at line 1, column 1. Encountered: "\ubc29" (48169), after : "" Parsing : 방향='S'.</ows:ExceptionText>

Anyone knows the reason why and the solution?

1 Answer 1

5

Because the grammar of CQL defines an identifier as:

    < IDENTIFIER: (<LETTER> (<LETTER>|<DIGIT>)*) | <DOUBLE_QUOTE> (<ANY>)+ <DOUBLE_QUOTE> > |

    < #ANY: ~[" ","\""] > |
    < #LETTER: [ "a"-"z", "A"-"Z" , "_"] > |

However check the second form of the identifier, <DOUBLE_QUOTE> (<ANY>)+ <DOUBLE_QUOTE>: you should be able to get your attribute names work by double quoting them, e.g. "방향"='S'

1
  • Thank you very much!
    – gameon67
    Jun 25, 2020 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.