Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work for input in UTF-8 if dictionary encoding is ISO-8859-1 #15

Open
nkrot opened this issue Aug 4, 2016 · 0 comments
Open

Comments

@nkrot
Copy link

nkrot commented Aug 4, 2016

Looks like the gem expects the user to know the encoding of the dictionaries.

require 'ffi/hunspell'
dict = FFI::Hunspell.dict('de_DE')

# kinda surprising
dict.valid?("Vergnügungseinrichtungen")
#=> false

# works as expected
dict.valid?("Vergnügungseinrichtungen".encode("iso-8859-1"))
#=> true

dict.encoding
#=> #<Encoding:ISO-8859-1>

To make it work, I have to paranoically recode each word like this:

dict.valid?("Vergnügungseinrichtungen".encode(dict.encoding))
#=> true

Contrast with the console utility (tested in locales en_US.utf8 and de_DE.utf8) that sorts out the encoding itself:

> echo Vergnügungseinrichtungen | hunspell -d de_DE
Hunspell 1.3.3
-

Maybe it makes sense fixing ze issue in the gem or at least commenting on it in the documentation.

Tested on debian jessie, with ruby 2.2.4p230.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant