emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/spell-fu 86d46cf63e 37/86: fix: encode word to utf8


From: ELPA Syncer
Subject: [nongnu] elpa/spell-fu 86d46cf63e 37/86: fix: encode word to utf8
Date: Thu, 7 Jul 2022 12:03:41 -0400 (EDT)

branch: elpa/spell-fu
commit 86d46cf63e858f17e83e36e2574b06fb1403bc1f
Author: R0flcopt3r <12752060+R0flcopt3r@users.noreply.github.com>
Commit: R0flcopt3r <12752060+R0flcopt3r@users.noreply.github.com>

    fix: encode word to utf8
    
    This solves issues where non-ascii characters are marked as incorrect.
    This is only tested with the norwegian characters: æ, ø, å.
    
    Contents of `spell-fu--cache-table`
    ```lisp
    (let ((result '()))
      (dolist (x (hash-table-keys spell-fu--cache-table))
        (when (string-match-p "^h..r$" x)
          (push x result)))
      result)
    => ("h\303\270r" "h\303\246r" "h\303\245r" ... "haar")
    ```
    
    Using `encode-coding-string` the norwegian characters are properly
    encoded to the same as in the table:
    
    ```lisp
    (encode-coding-string "æ ø å" 'utf-8)
    => "\303\246 \303\270 \303\245"
    ```
    
    fixes #8
---
 spell-fu.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spell-fu.el b/spell-fu.el
index f5e5a3d612..0a16b44c05 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -463,7 +463,7 @@ range POINT-START to POINT-END. Otherwise remove all 
overlays."
 Marking the spelling as incorrect using `spell-fu-incorrect-face' on failure.
 Argument POINT-START the beginning position of WORD.
 Argument POINT-END the end position of WORD."
-  (unless (gethash (downcase word) spell-fu--cache-table nil)
+  (unless (gethash (encode-coding-string (downcase word) 'utf-8) 
spell-fu--cache-table nil)
     ;; Ignore all uppercase words.
     (unless (equal word (upcase word))
       (spell-fu-mark-incorrect point-start point-end))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]