vermiculus / magithub

**DEPRECATED - please use Forge instead!** -- Magit-based interfaces to GitHub
GNU General Public License v3.0
579 stars 63 forks source link

Multibyte characters (such as 中文) not shown correctly when using cache #259

Closed xuchunyang closed 6 years ago

xuchunyang commented 6 years ago

When I visit the git repo for the first time, magithub displays correctly, but later it doesn't:

screen shot 2018-02-03 at 2 24 54 am

I think it only happens when using cache, because I get correct result again right after C-u h.

By the way, I add two Chinese characters in the issue title, so you can reproduce the issue, maybe you also need to restart Emacs

vermiculus commented 6 years ago

I'm unfortunately not able to reproduce. What's the value of these variables in your session?

image
xuchunyang commented 6 years ago
magithub-cache
     => when-present

(with-current-buffer "*magit: youdao-dictionary.el"
  enable-multibyte-characters)
     => t
vermiculus commented 6 years ago

magithub-cache-read-from-disk might be a fault point here if enable-multibyte-characters isn't set early enough. What's the value of enable-multibyte-characters when you load magithub? (Probably the best way to test this is to edit your local copy of magithub and restart emacs. On a related note, make sure load-prefer-newer is t unless you want to delete all the .elc files.)

xuchunyang commented 6 years ago

I think enable-multibyte-characters is always t (the default) for me since I don't change it.

When I visit the cache file, Emacs also doesn't show it with UTF-8 encoding automatically. I notice the cache files of recentf and bookmark set file local variable coding to UTF-8, maybe magithub should do the same.

vermiculus commented 6 years ago

I'm not sure why I'm not having this problem, then.

When I visit the cache file, Emacs also doesn't show it with UTF-8 encoding automatically.

It shows \234\253\... garbage? When I (find-file (expand-file-name magithub-cache-file magithub-dir)), it will show the multibyte characters readably.

xuchunyang commented 6 years ago

I delete the cache file then am unable to reproduce the issue, I am not sure why. The deleted cache file is very large (since I have used magithub with many git repos), maybe it contains some invalid UTF-8 byte sequences which prevent Emacs from treating it as UTF-8 file, I can't know as I have deleted the cache file.

Feel free to close the issue because I have no idea how to reproduce it.

vermiculus commented 6 years ago

Weird.