Pergunta

I managed to setup my app with a search based on acts_as_ferret. Overall it works fine. But I can't find results for words with umlauts (e. g. “Getränke”).

I added this to my environment.rb and rebuilt the index from scratch, but no better results.

Ferret.locale = "de_DE.UTF-8"

I double checked my database table, but I think this should be perfect:

DEFAULT CHARSET=utf8 COLLATE=utf8_bin

BTW: The data is displayed fine in the database table (viewed with Sequel Pro).

Then I opened the index file with Textmate to search for the entry with “Getränke” and I fugured, the TextMate opened it with Mac Roman encoding and display the Umlaut like this

Getr‰nke

I reopened the index file with UTF-8 encoding, but then the strange charackters are displayed as rectangles with questionmarks.

How can I find results by searching words with German umlauts?

Foi útil?

Solução

This did the trick

environment.rb

$KCODE = 'u'
ENV['LANG'] = 'de_DE.UTF-8'
Ferret.locale = "de_DE.UTF-8"

database.yml

development:
  encoding: utf8
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top