Subject: [PATCH] Fix ispell problem with hunspell and UTF-8 file

From: Николай Сущенко<[email-masked]>
Date: Sat, 13 Apr 2013 23:12:38 +0400

As soon as I can see, the hunspell team haven't fixed the bug in more 
then 2 years. Maybe for them it is not a bug but a feature.

The problem is that hunspell reports byte-position instead of 
char-position with multi-byte character input, while Emacs waits for 
char-position. With the patch attached I propose to make conversation in 
the ispell-parse-output function.

Thanks,
Nikolay Suschenko
--- a/lisp/textmodes/ispell.el	2013-02-22 13:09:26.000000000 +0400
+++ b/lisp/textmodes/ispell.el	2013-04-13 22:46:35.209323584 +0400
@@ -2597,7 +2597,11 @@
 	  (setq count 0)		; no misses for type #
 	(setq count (string-to-number output) ; get number of misses.
 	      output (substring output (1+ (string-match " " output 1)))))
-      (setq offset (string-to-number output))
+      ; hunspell reports byte-position instead of char-position
+      ; with multi-byte character input
+      (setq offset (if ispell-really-hunspell
+		       (byte-to-position (string-to-number output))
+		     (string-to-number output)))
       (setq output (if (eq type ?#)     ; No miss or guess list.
                        nil
                      (substring output (1+ (string-match " " output 1)))))