Skip to content

LeaderfLine have UnicodeEncodeError in some file by use vim binary mode #165

@fcying

Description

@fcying
  • vim or neovim?

    • vim
    • neovim
  • vim --version or nvim --version: vim 8.1 1-26

  • Output of :echo has("python"): 1

  • Output of :echo has("python3"): 1

  • Output of :echo &pythondll(only vim, not neovim): libpython2.7.so.1.0

  • Output of :echo &pythonthreedll(only vim, not neovim): libpython3.6m.so.1.0

  • Output of :py print(sys.version): 2.7.15 (default, May 1 2018, 20:16:04)[GCC 7.3.1 20180406]

  • Output of :py3 print(sys.version): 3.6.5 (default, May 11 2018, 04:00:52)[GCC 8.1.0]

  • Operating system:

    • Linux
    • Mac OS X
    • [] Windows
    • Etc.
  • Configurations related to LeaderF in vimrc:

    let g:Lf_PreviewCode = 0
    let g:Lf_DefaultMode = 'FullPath'
    let g:Lf_WildIgnore = {
           \ 'dir': ['.svn','.git','.hg'],
           \ 'file': ['*.sw?','~$*','*.bak','*.exe','*.o','*.so','*.py[co]']
           \}

Describe your question, feature request, or bug.

LeaderfLine work error in special file by use vim binary mode
normal mode work fine.

Steps to reproduce

vim -b t.log
:LeaderfLine

Actual behaviour

searching ...
Error detected while processing function leaderf#Line#startExpl[2]..leaderf#LfPy:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/fcying/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 769, in startExplorer
    self._getInstance().setBuffer(content)
  File "/home/fcying/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/instance.py", line 238, in setBuffer
    self._buffer_object[:] = content
UnicodeEncodeError: 'utf-8' codec can't encode character '\udca0' in position 76: surrogates not allowed
Error detected while processing function leaderf#Line#startExpl:
line    2:
E171: Missing :endif
Press ENTER or type command to continue

Expected behaviour

work fine

test file:

t.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions