Re: Hunsepll in Emacs - charset error for Swedish dictionary

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.windows
Message-ID <[email protected]>
> From: arthur miller <[email protected]>
> Date: Tue, 8 Apr 2014 17:20:06 +0200
> Cc: "[email protected]" <[email protected]>
> 
> > 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/

Please try with Emacs 24.3 first.  With that version, I succeed in
using the Swedish dictionary above by doing the following:

  emacs -Q
  (setq ispell-program-name
      (locate-file "hunspell" exec-path exec-suffixes 'file-executable-p))
  (setq
    ispell-local-dictionary-alist
    '(("svenska"
          "[A-ZÖÄÅa-zöäå]"
	  "[^A-ZÖÄÅa-zöäå]"
	  "[']"
	  nil
	  ("-d" "sv_SE")
	  t
	  utf-8)))

   C-x h
   M-x eval-region RET
   M-x ispell-change-dictionary RET svenska RET

Now go to some word in the buffer and type M-$.  You should see
suggestions for correcting the "typo".

The above assumes hunspell.exe is on PATH.  If it isn't, modify the
first setq to specify a full absolute file name of hunspell.exe.

If the above doesn't work for you, then please try the hunspell.exe
binaries from the ezwinports site.  When I ported Hunspell to Windows,
I fixed several bugs in it; it is possible that the sources you
compiled don't include those fixes, in which case the problems you see
are expected.
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.