Let eruby checker can handle UTF-8

This commit is contained in:
Manic Chuang 2013-06-12 12:08:42 +08:00
parent da7002516b
commit 73a83a3208

View File

@ -25,6 +25,9 @@ endfunction
function! SyntaxCheckers_eruby_ruby_GetLocList()
let exe = expand(g:syntastic_ruby_exec)
let encoding_string = ''
if &encoding == 'utf-8'
let encoding_string = ', :encoding => "UTF-8"'
if !has('win32')
let exe = 'RUBYOPT= ' . exe
endif
@ -34,7 +37,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
"gsub fixes issue #7, rails has it's own eruby syntax
let makeprg =
\ exe . ' -rerb -e ' .
\ shellescape('puts ERB.new(File.read("' . fname . '").gsub(''<\%='',''<\%''), nil, ''-'').src') .
\ shellescape('puts ERB.new(File.read("' . fname . '"' . encoding_string . ').gsub(''<\%='',''<\%''), nil, ''-'').src') .
\ ' \| ' . exe . ' -c'
let errorformat =