Giter VIP home page Giter VIP logo

Comments (4)

dyng avatar dyng commented on July 24, 2024

确实是bug,因为路径是GBK编码的而缓冲区则用utf-8打开,所以导致了乱码。

感谢提交issue!

from ctrlsf.vim.

dyng avatar dyng commented on July 24, 2024

感觉这个问题有点困难。粗略看了一下 nerdtree 里的路径是通过getcwd()之类的函数由 vim 传进来的,所以已经转换成了 utf-8 编码。而 ctrlsf 的路径和文件名则是外部程序的ack或者ag的输出结果,没有经过编码转换。目前能够想到的办法就只有想办法自己解码或者设定缓冲区编码。(但还有一个问题,如果文件内容和路径是不同编码的话,就很难办了)

from ctrlsf.vim.

Yggdroot avatar Yggdroot commented on July 24, 2024

外部程序的输出结果,其编码一般和locale一致,如果vim的encoding和locale一致,就不会出现乱码。如果能获得locale的编码,再转换成&encoding对应的编码,乱码问题就会解决。通过vim脚本貌似很难实现,不过可以使用python来解决编码问题。

from ctrlsf.vim.

dyng avatar dyng commented on July 24, 2024

诚如你所说,这个问题解决起来比较困难。(而且因为我不是windows系统,测试也比较麻烦)目前插件还存在着很多其他影响面更广的问题(特别是高亮不正确,以及部分 escape有问题),所以我想先把这个issue放一下。如果你找到了好的解决办法的话,还请提出pull-request,thx!

ps: 我觉得可能可以从改变源头出发。目前 ctrlsf 的机制是把 ag 的输出结果改变一下样式以后直接显示出来,所以受制于 ag 的编码处理。可以换成对 ag 的结果只是解析,在解析得到所有匹配的位置以后,自己通过读取这些位置的文件内容来组织显示的结果,这样应该就可以解决编码问题了。

from ctrlsf.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.