Problem with chars encoding in searchBuilder

Problem with chars encoding in searchBuilder

impartimpart Posts: 2Questions: 1Answers: 0

Hi,
I'm experincing strange behaviour with polish chars in input cotrol in searchBuilder (see attached screenshot from official site under link https://datatables.net/extensions/searchbuilder/examples/initialisation/date-fmt-luxon.html).

The component finds the letter 'ą' as 'a' and letter 'ń' as 'n'.

What should I change to make this work correctly?
Please help!

Peter

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,302Questions: 1Answers: 10,618 Site admin
    Answer ✓

    Hi Peter,

    DataTables will "normalise" the characters to search on, as that is often (but not always!) desirable. If you don't want it to do that you can use DataTable.util.diacritics() to set your own normalisation function (in this case, no change to the characters).

    Try:

    DataTable.util.diacritics(d => d);
    

    Add that just before you initialise your DataTable.

    Allan

  • impartimpart Posts: 2Questions: 1Answers: 0

    OMG - it works!
    Thank you very much, Allan.

    Peter

  • allanallan Posts: 64,302Questions: 1Answers: 10,618 Site admin

    Good to hear that did the job!

    I saw you added a comment to the page - I think it is actually important enough to be included in the documentation (probably should have been from the start...), so I've committed a change to that effect and it will be live on the site soon.

    Allan

Sign In or Register to comment.