Win-specific: Pass file names to hunspell library in local 8-bit encoding

This commit is contained in:
Abs62 2013-11-05 22:10:35 +04:00
parent dd84c10e2e
commit 8ad27b607b

View file

@ -34,6 +34,13 @@ class HunspellDictionary: public Dictionary::Class
string name;
Hunspell hunspell;
#ifdef Q_OS_WIN32
static string Utf8ToLocal8Bit( string const & name )
{
return string( QString::fromUtf8( name.c_str() ).toLocal8Bit().data() );
}
#endif
public:
/// files[ 0 ] should be .aff file, files[ 1 ] should be .dic file.
@ -41,7 +48,11 @@ public:
vector< string > const & files ):
Dictionary::Class( id, files ),
name( name_ ),
#ifdef Q_OS_WIN32
hunspell( Utf8ToLocal8Bit( files[ 0 ] ).c_str(), Utf8ToLocal8Bit( files[ 1 ] ).c_str() )
#else
hunspell( files[ 0 ].c_str(), files[ 1 ].c_str() )
#endif
{
}