From 8ad27b607be61bc1756f47e6f1fd68b6306dd792 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Tue, 5 Nov 2013 22:10:35 +0400 Subject: [PATCH] Win-specific: Pass file names to hunspell library in local 8-bit encoding --- hunspell.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hunspell.cc b/hunspell.cc index 066f39cc..a1175408 100644 --- a/hunspell.cc +++ b/hunspell.cc @@ -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 { }