21
21
eq(3, eval('strwidth("Bär")'))
24
it('can be changed before startup', function()
25
clear('set enc=latin1')
26
execute('set encoding=utf-8')
27
-- error message expected
29
eq('latin1', eval('&encoding'))
30
eq(4, eval('strwidth("Bär")'))
24
33
it('is not changed by `set all&`', function()
25
-- we need to set &encoding to something non-default
26
-- use 'latin1' when enc&vi is 'utf-8', 'utf-8' otherwise
27
execute('set fenc=default')
28
local enc_default, enc_other, width = eval('&fenc'), 'utf-8', 3
29
if enc_default == 'utf-8' then
31
width = 4 -- utf-8 string 'Bär' will count as 4 latin1 chars
34
clear('set enc=' .. enc_other)
34
-- we need to set &encoding to something non-default. Use 'latin1'
35
clear('set enc=latin1')
35
36
execute('set all&')
36
eq(enc_other, eval('&encoding'))
37
eq(width, eval('strwidth("Bär")'))
37
eq('latin1', eval('&encoding'))
38
eq(4, eval('strwidth("Bär")'))