Re: Hunsepll in Emacs - charset error for Swedish dictionary

arthur miller <[email protected]>
Newsgroups gmane.emacs.windows
Message-ID <[email protected]>

> Date: Tue, 8 Apr 2014 18:06:03 +0300
> From: [email protected]
> Subject: Re: [h-e-w] Hunsepll in Emacs - charset error for Swedish dictionary
> To: [email protected]
> CC: [email protected]
> 
> > From: arthur <[email protected]>
> > Date: Tue, 8 Apr 2014 03:58:31 +0000 (UTC)
> > 
> > I have finally managaed to get Emacs + Hunspell to work on Windows (should a
> > spellchecker really be this difficult to get up running????).
> 
> I will try to answer that question on emacs-devel (FWIW, I didn't have
> such hard time setting up hunspell).
> 
> > It works fine for american enligsh dictionary (en_US), but I can't get it to
> > work for swedish.
> > 
> > I am getting "Ispell and its process have different character maps" all the
> > time.
> > 
> > I am sure dictionary is in iso-8859-1 encoding as well as my buffer,
> 
> Try using utf-8 instead of iso-8859-1.  I don't think the encoding of
> the dictionary matters (hunspell will convert if needed).  You should
> try using utf-8 with hunspell by default.
> 

I did! Before I posted - I used email-lists as a last resort.

I have tryed with utf-8 everywhere where it could matter, and I have also tryed
iso-8859-1-dos . I have try to instruct Emacs to use for LANG as in sv_SE.iso8859-1-dos,
and so on.

I have just tryed it again - it does no changes at all. Here are setting I used with utf-8 instead:

(after 'ispell
  (message "loading spellchecker")
  (defvar *load-start* (current-time))
  (defun anarcat/time-to-ms (time)
    (+ (* (+ (* (car time) (expt 2 16)) (car (cdr time))) 1000000) (car (cdr (cdr time)))))

  (add-to-list 'ispell-dictionary-alist '(("svenska"
                       "[A-ZÖÄÅa-zöäå]"
                       "[^A-ZÖÄÅa-zöäå]"
                       "[']"
                       nil
                       ("-d" "sv_SE")
                       t
                       utf-8)
                      ("svenska8"
                       "[A-ZÖÄÅa-zöäå]"
                       "[^A-ZÖÄÅa-zöäå]"
                       "[']"
                       nil
                       ("-B" "-d" "sv_SE")
                       t
                       utf-8)
                      ("english"
                       "[[:alpha:]]"
                       "[^[:alpha:]]"
                       "[']"
                       t
                       ("-d" "en_US")
                       nil
                       utf-8)))

  (setq ispell-local-dictionary-alist ispell-dictionary-alist)
  (setq ispell-hunspell-dictionary-alist ispell-dictionary-alist)
  (setq ispell-dictionary "english")
  (setq-default ispell-program-name "hunspell")
  (setq ispell-extra-args '("-i" "utf-8"))
  (global-set-key (kbd "C-c d") 'switch-dictionary-sv-en))

And settings for Emacs to use utf-8

(set-language-environment 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

> (Btw: where did you get that Swedish dictionary?)

Files are from OpenOffice repository: http://archive.services.openoffice.org/pub/mirror/OpenOffice.org/contrib/dictionaries/

I have put a small blogg about this at 

Thanks for help!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.