Since: DataTables 2.0

Normalise diacritic characters in a string.


When searching in DataTables we provide the ability to search for words which have accented characters without typing the accent. For example searching for Desiree would match Désirée.

This method exposes that ability for external use as well as the ability to replace the diacritic removal method that DataTables uses.

Our default method uses the normalize method in Javascript with a NFD normalisation form. The way this works is to decompose the accented character into a base ASCII character plus its accent as a second character. We then remove the accent characters.


function diacritics( str [, appendOriginal] )


Normalise diacritic characters in a string.


Updated string

function diacritics( fn )


Set the diacritic removal function.


Remove diacritics from a string:

let noAccents = DataTable.util.diacritics('Crème Brulée');

// result is: 'Creme Brulee'