jQuery UI Widgets Forums Grid Filter and characters with accents

This topic contains 4 replies, has 2 voices, and was last updated by  antonomase 11 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Filter and characters with accents #13520

    antonomase
    Participant

    Hi,

    I have a Grid with some columns. The first one (nom) contains name of societies with accents like ‘Bergère de France’ or ‘Fürstenberg’

    I have installed a filter on this columns :

    {text: ‘Nom‘, datafield: ‘NOM’, filtertype: ‘textbox’, filtercondition: ‘contains’},

    If i write Berg in the textbox, I have all the names containing b e r and g : it’s OK.
    But if i write Bergè or Berge (without accent), the grid becomes empty.

    How can the filter condition work with characters with accents ?

    Best regards,

    Filter and characters with accents #13528

    Peter Stoev
    Keymaster

    Hi antonomase,

    The possible filter conditions are explained in this help topic: jquery-grid-filtering.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Filter and characters with accents #13532

    antonomase
    Participant

    Hi,

    Thanks for your answer. But i do not see a special condition for filtering words containing characters like é, ç, à, ü, …

    How is it possible to have the “standard” filter working with words containing these characters ?

    Filter and characters with accents #13534

    Peter Stoev
    Keymaster

    Hi antonomas

    The filtering uses JavaScript operators like

    ==, <, >, <=, >=

    to compare strings, numbers, dates, bool values. I suppose that to compare such strings, you will have to specify appropriate encoding to your page.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Filter and characters with accents #13570

    antonomase
    Participant

    Hi Peter,

    Thanks for your answer.

    For having letters encoded send by ajax/json, I must encode them on the server otherwise the string with accentuated letters remains blank.
    (code PHP)

    ...
    while ($rs->fetchInto($row)) {
    $result[$i]["ID"] = $row["ID"];
    $result[$i]["NOM"] = htmlentities($row["NOM"]);
    $result[$i]["VILLE"] = htmlentities($row["VILLE"]);
    $i++;
    }
    echo json_encode($result)

    ;

    The string received by javascript contains html encoding like “Bergère”. So the comparison with “Bergère” typed on the keyboard does not work.

    The solution is to decode html encoded string with this tool http://www.strictly-software.com/htmlencode (or another one)

    var eta_GridModel = function () {
    this.items = ko.observableArray();
    var me = this;
    $.ajax({
    datatype: 'json',
    url: "return_list.php"
    }).done(function (data) {
    data = Encoder.htmlDecode(data);
    var jsonData = $.parseJSON(data);
    me.items(jsonData);
    });
    }

    And now, the filter works.
    The problem will be the same with string containing © or another &xxxx; character.

    Best regards

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.