sjbach / lusty

LustyExplorer / LustyJuggler for Vim
http://www.vim.org/scripts/script.php?script_id=1890
256 stars 30 forks source link

Encoding issue #110

Closed FR4N7Z closed 6 years ago

FR4N7Z commented 6 years ago

Hello, When I start lustyexplorer from vim n windows, I got the following error :

unknown encoding name - latin1 eval:803:in force_encoding' eval:803:inrun_from_path' eval:1:in block in <main>' eval:253:inprofile' eval:1:in `

'

I am running Windows 10, gvim80-586, ruby 2.2.6

Thank you.

sjbach commented 6 years ago

Thanks for the report. I think the issue is that the environment calls the encoding "latin1", but Ruby only knows that encoding by the name "ISO-8859-1". Does this patch fix it for you?

diff --git a/autoload/lustyexplorer.vim b/autoload/lustyexplorer.vim
index e97b17d..1a88d7b 100644
--- a/autoload/lustyexplorer.vim
+++ b/autoload/lustyexplorer.vim
@@ -893,7 +893,9 @@ class FilesystemExplorer < Explorer
         path = VIM::getcwd()
       end
       if path.respond_to?(:force_encoding)
-        path = path.force_encoding(VIM::evaluate('&enc'))
+        encoding = VIM::evaluate('&enc')
+        encoding = 'ISO-8859-1' if encoding == 'latin1'
+        path = path.force_encoding(encoding)
       end
       @prompt.set!(path + File::SEPARATOR)
       run()
FR4N7Z commented 6 years ago

Hello, thank you for the patch but it's still doesn't work. Thanks for your help.

sjbach commented 6 years ago

Can you tell me more? What error does it give you after the patch?

FR4N7Z commented 6 years ago

unknown encoding name - latin1 eval:803:in force_encoding' eval:803:inrun_from_path' eval:1:in block in <main>' eval:253:inprofile' eval:1:in `

'

sjbach commented 6 years ago

It doesn't look like the patch has been applied. Can you check again?

FR4N7Z commented 6 years ago

I put all the text of your patch in a textfile.patch and applyed patch -i textfile.patch lusty-explorer.vim

When I open the file now, lines 1130 to 1138 look like : path = VIM::getcwd() end if path.respond_to?(:force_encoding) encoding = VIM::evaluate('&enc') encoding = 'ISO-8859-1' if encoding == 'latin1' path = path.force_encoding(encoding) end @prompt.set!(path + File::SEPARATOR) run()

sjbach commented 6 years ago

Okay. The patch should be applied to autoload/lustyexplorer.vim, not lusty-explorer.vim. Also: those line numbers are suspicious, as lusty-explorer.vim is only 284 lines long.

I'm pretty sure this patch fixes the problem, so I'll just commit it and you can let me know if it works for you at HEAD.

FR4N7Z commented 6 years ago

OK I understand but I'm using vundle so I don't have an autoload folder. Should I use Pathogen for this plugin? I tried to update the plugin but it still doesn't work. Thank you

sjbach commented 6 years ago

I don't use Vundle or Pathogen, so I can't help you there. The README shows the installation instructions that I follow.

This is/was a legitimate issue, so thanks for taking the time to report it, and I'm pretty sure it's fixed now. Good luck straightening out your configuration. (No snark intended.)

FR4N7Z commented 6 years ago

Now it works with the patch. Thanks a lot.