String comparison with a collation in javascript

Posted by fsb on Stack Overflow See other posts from Stack Overflow or by fsb
Published on 2010-04-14T02:11:04Z Indexed on 2010/04/14 2:13 UTC
Read the original article Hit count: 452

Filed under:

I use jquery.autocomplete, which uses a javascript regexp to highlight substrings in the list of suggestions that match the autocomplete key string. So if the use types "Beat" and one of the autocomplete suggestions the server returns is "The Beatles" then plugin displays that suggestion as "The Beatles".

I'm trying to think of ways to make this work with string matching that isn't sensitive to accents, diacriticals and the rest. So if the user typed "Huske" and the server suggested "Hüsker Dü" then this would be displayed as "Hüsker Dü".

The principle is the same as string comparison with specified collations such as in MySql or ICU, or with Oracle's sorts. In SphinxSearch a charset_table works for this. A collation such as utf8_general_ci would be ideal for my purposes.

© Stack Overflow or respective owner

Related posts about JavaScript