material icon indicating copy to clipboard operation
material copied to clipboard

md-autocomplete ignore characters with accent

Open dcoferraz opened this issue 11 years ago • 5 comments

Hello,

I'm using the md-autocomplete to use with searches that can result in cases like "René". I want my end user to type "Rene" and see "René" in the results.

Is there a way of doing that?

Thanks

dcoferraz avatar Sep 28 '15 19:09 dcoferraz

@robertmesserle It seems to me that we should allow users to specify a custom matching function. What do you think?

jelbourn avatar Sep 28 '15 23:09 jelbourn

@jelbourn Hm, that's a good point. This was discussed at some point in time, but I don't recall where that discussion ended up. I'm not sure what that matching function would look like, though - at that point, it might just require a custom directive rather than our out-of-the-box functionality.

robertmesserle avatar Sep 28 '15 23:09 robertmesserle

Thank you @jelbourn and @robertmesserle for answering!

Inspite of the milestone, would you guys suggest a way of implementing this feature?

dcoferraz avatar Sep 29 '15 13:09 dcoferraz

Modified MdHighlightCtrl to support diacritics (accents).

It could be done by replacing all diacritics letters with a regex (ex: e -> [eéèê]) or comparing strings without them.

Here's a gist of the progress i've done so far: https://gist.github.com/antoinebrault/eec14ea3fee725aebe49

It based on http://stackoverflow.com/questions/990904/javascript-remove-accents-diacritics-in-strings#answer-18391901

It seems to be working for me with french characters.

antoinebrault avatar Dec 22 '15 14:12 antoinebrault

see: https://github.com/selectize/selectize.js/blob/043420284064ad998b07e1abd9720f56c86d6614/dist/js/standalone/selectize.js#L58 https://github.com/select2/select2/blob/8ad8f200ba8c9429d636453b8ee3bcf593e8c87a/src/js/select2/defaults.js#L300

antoinebrault avatar Jan 11 '16 13:01 antoinebrault