In our RoR project we use postgres unaccent function to retrieve unaccent version of one of our models name attribute. The name attribute can contain any accented characters from various languages. We then save it as unaccent_name attribute. I don't like this solution because we need to be sure to have installed and accessible postgres extension UNACCENT (when testing, moving/cleaning database, and so on).
In RoR there is ActiveSupport::Inflector.transliterate method, which should do something very similar.
I've found that it mostly translates accented characters the same way, but there is also some difference:
same result:
SELECT unaccent('ľščťžý') AS unaccent_name;
=> "lsctzy"
ActiveSupport::Inflector.transliterate('ľščťžý')
=> "lsctzy"
different result:
SELECT unaccent('ß') AS unaccent_name;
=> "S"
ActiveSupport::Inflector.transliterate('ß')
=> "ss"
I know both of these methods can accept dictionaries with custom letter replacements, but I'm only interested in their general/default usage.
Is the main purpose of transliterate method same as postgres unaccent function? Can we use it as a replacement?