raspell
raspell copied to clipboard
raspell dosn't return valid encodings (ruby 1.9)
raspell suggest method returns asci-8bit strings instead of the correct encoding that was requested.
# -*- encoding : utf-8 -*-
require 'raspell'
w = "πράσυνο"
as = Aspell.new('el_GR', nil, nil, 'utf-8')
res = as.suggest(w)
p res
p res.first.encoding
Prints:
["\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xBF", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCF\x8C", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xBF\xCF\x82", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xBF\xCF\x85", "\xCF\x80\xCF\x81\xCE\xB1\xCF\x83\xCE\xAF\xCE\xBD\xCE\xBF\xCF\x85", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xBF\xCE\xB9", "\xCE\xA0\xCF\x81\xCE\xB1\xCF\x84\xCE\xAF\xCE\xBD\xCE\xBF", "\xCE\xB8\xCF\x81\xCE\xB1\xCF\x83\xCF\x8D\xCE\xBD\xCF\x89", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xB1", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xB5", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCE\xB7", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xBF\xCE\xBD", "\xCF\x80\xCF\x81\xCE\xB1\xCF\x83\xCE\xB9\xCF\x8E\xCE\xBD", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xBF", "\xCF\x80\xCF\x81\xCE\xAC\xCF\x83\xCE\xB9\xCE\xBD\xCF\x89\xCE\xBD", "\xCF\x80\xCF\x81\xCE\xB1\xCF\x83\xCE\xAF\xCE\xBD\xCF\x89\xCE\xBD", "\xCF\x80\xCF\x81\xCE\xB1\xCE\xB0\xCE\xBD\xCF\x89"]
#<Encoding:ASCII-8BIT>
I don't personally use Raspell anymore so mostly I curate pull requests...patches welcome, if you can figure it out.
Fair enough. As a quick fix, I force encode the results to utf-8.
I 'll see if I can write a patch for it.