Filter-Problem with German "Umlaut" (even with Entity)

Filter-Problem with German "Umlaut" (even with Entity)

RockbRockb Posts: 97Questions: 0Answers: 0
edited May 2014 in DataTables 1.10

Actually I don't know, if this is a new problem by 1.10, but I remember it worked some day. In my mysql-database I save all strings as entities to prevent problems later. The related Names (which contain german Umlauts like ö, ü or ä) are displayed in the table correctly! It doesn't matter, if I decode them in server_processing.php or not. The problem is the search/filter. I can't search for them, even if i add a function something like this:

array( 'db' => 'Name', 'dt' => 2, 'formatter' => function( $d, $row ) { return html_entity_decode($d, ENT_QUOTES, "UTF-8");  } ),

So it's probably a bug?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Sonds like an SQL issue. If your database stores the characters are entities then you would need to also have the filtering inputs encoded into entities as well - since ü !== ü.

    Allan

  • RockbRockb Posts: 97Questions: 0Answers: 0

    ...but it definitly worked in earlier versions and also with entities and also server-side processed. Furthermore I don't understand why it should be an sql-issue. And irrespective of the entity-problem, if it's decoded and formated in utf-8, it's the "real" string - and even these words can't be searched for in the filter.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    I'd probably need a test case showing the issue and showing it working to understand fully the issue and how it can be resolved.

    I guess the first step is confirm if the search is being done with ü as the input and checking against ü in the database. Is that happening? If so, then its certainly not going to match without some kind of modification.

    Allan

  • RockbRockb Posts: 97Questions: 0Answers: 0

    I sent you the link to the table, where the source has no entities, but the "right" and utf-8-encoded string like "Nürnberger Zeitung", which is displayed in the table, but you can't search for.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Thanks for the link. If I search for "ürnberger" then the server is sent the following as an http variable:

    %C3%BCrnberger

    My understanding is that will be automatically decoded by PHP to be ürnberger which you are then searching for. However, you said before that you are storing the HTML entities in the database rather than the UTF string. So you need to HTML encode the search string as well, as I said before.

    Allan

  • RockbRockb Posts: 97Questions: 0Answers: 0

    Adding this to the top of examples/server_side/scripts/server_processing.php will solve the 'issue':

    $_GET['search']['value']=htmlentities($_GET['search']['value'],ENT_QUOTES,'UTF-8');
    
This discussion has been closed.