From fdc7fccf4a95efc07d537d938b95ba03e27ddd33 Mon Sep 17 00:00:00 2001 From: cyy Date: Sat, 29 Feb 2020 11:11:22 +0800 Subject: [PATCH] Add Windows iconv conversion --- autoload/ale.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/autoload/ale.vim b/autoload/ale.vim index d1c1112a54..a9a4cf48b8 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -275,7 +275,20 @@ function! ale#GetLocItemMessage(item, format_string) abort " Windows may insert carriage return line endings (^M), strip these characters. let l:msg = substitute(l:msg, '\r', '', 'g') + if has('win32') + let l:to = &encoding + + if l:to is# 'utf-8' + + let l:res = iconv(l:msg, 'default', l:to) + if l:res isnot# '' && stridx(l:res, '?') == -1 + let l:msg=l:res + endif + endif + endif + return l:msg + endfunction " Given a buffer and a linter or fixer name, return an Array of two-item