1

I use the Levenshtein plugin for MySQL from: http://samjlevy.com/2011/03/MySQL-levenshtein-and-damerau-levenshtein-udfs/

I'm trying a query like:

SELECT name FROM database WHERE levenshtein(name, 'testć')

the problem is that levenshtein function doesnt handle accented characters. I need levenshtein to recognize characters like "C" and "Ć" (and others accented) as the same. So i decided to replace all of it in MySQL, but cant find any function for that. Like:

SELECT name FROM database WHERE levenshtein(toAscii(name), toAscii('testć'))

I dont want to use something like REPLACE( REPLACE(name, "ś", "s"), "ć", "c" ); It may be slow and it looks horrible.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
ElSajko
  • 1,612
  • 3
  • 17
  • 37
  • It isn't really correct to "strip" accents. Accented glyphs are different characters, and a simple transliteration will mangle words. The correct substitution depends on the language and sometimes the individual word. The best way to do this is via a substitution dictionary. While this SO is about Perl, the principles and comments apply: http://stackoverflow.com/questions/7429964/how-to-match-string-with-diacritic-in-perl – Craig Ringer Sep 21 '12 at 01:33
  • @tchrist Awoogah, Awooga, code trying to "strip" accents ahoy – Craig Ringer Sep 21 '12 at 01:36

0 Answers0