summarylogtreecommitdiffstats
path: root/spell-check_patch
blob: 3e5cac1c9018340ce1eda875be4990310f1f20a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- textroom-0.8.2/application/src/textroom.cpp	2014-05-26 16:04:11.155079095 +0400
+++ textroom-svn/application/src/textroom.cpp	2014-05-26 16:50:26.250577206 +0400
@@ -28,6 +28,7 @@
 ****************************************************************************/
 
 #include <QtGui> 
+#include <QTextCodec>
 #include <SDL/SDL.h>
 #ifdef Q_OS_MACX
 # include <SDL_mixer/SDL_mixer.h>
@@ -1163,6 +1164,7 @@
 #endif
 
 	pMS= new Hunspell(affFileName.toLocal8Bit(), dicFileName.toLocal8Bit());
+	QTextCodec *pDC = QTextCodec::codecForName(pMS->get_dic_encoding());
 	QTextCharFormat highlightFormat;
 	highlightFormat.setUnderlineColor(Qt::red);
 	highlightFormat.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
@@ -1182,7 +1184,7 @@
 		QTextCursor highlightCursor(textEdit->document()->find(word, findCursor));
 		findCursor.setPosition(highlightCursor.position());
 		findCursor.movePosition(QTextCursor::EndOfWord);
-		QByteArray ba = word.toUtf8();
+		QByteArray ba = pDC->fromUnicode(word);
 		char * wordChar = ba.data();
 		int correct = pMS->spell(wordChar);
 		if ( !correct && isHighlighted )