blob: a45ff847931dca649ef6a06cb04275c247fa7e3e [file] [log] [blame]
Bram Moolenaar617d7ef2019-01-17 13:04:30 +01001" Test for setting 'encoding' to something else than the terminal uses, then
2" setting 'termencoding' to make it work.
3
Christian Brabandt08ea2e12025-01-25 15:01:42 +01004source check.vim
5
Bram Moolenaar617d7ef2019-01-17 13:04:30 +01006" This only works with "iconv".
Christian Brabandt08ea2e12025-01-25 15:01:42 +01007CheckFeature iconv
Bram Moolenaar617d7ef2019-01-17 13:04:30 +01008
9source screendump.vim
10if !CanRunVimInTerminal()
Bram Moolenaar5d30ff12019-06-06 16:12:12 +020011 throw 'Skipped: cannot make screendumps'
Bram Moolenaar617d7ef2019-01-17 13:04:30 +010012endif
13
14" This Vim is running with 'encoding' "utf-8", the Vim in the terminal is
15" running with 'encoding' "euc-jp". We need to make sure the text is in the
16" right encoding, this is a bit tricky.
17func Test_termencoding_euc_jp()
Drew Vogelea67ba72025-05-07 22:05:17 +020018 CheckScreendump
Bram Moolenaar617d7ef2019-01-17 13:04:30 +010019 new
20 call setline(1, 'E89: バッファ %ld の変更は保存されていません (! で変更を破棄)')
21 write ++enc=euc-jp Xeuc_jp.txt
22 quit
23
24 call writefile([
25 \ 'set encoding=euc-jp',
26 \ 'set termencoding=utf-8',
27 \ 'scriptencoding utf-8',
28 \ 'exe "normal aE83: バッファを作成できないので、他のを使用します...\<Esc>"',
29 \ 'split Xeuc_jp.txt',
Bram Moolenaarc4860bd2022-10-15 20:52:26 +010030 \ ], 'XTest_tenc_euc_jp', 'D')
Bram Moolenaar617d7ef2019-01-17 13:04:30 +010031 let buf = RunVimInTerminal('-S XTest_tenc_euc_jp', {'rows': 10})
32 call VerifyScreenDump(buf, 'Test_tenc_euc_jp_01', {})
33
34 " clean up
35 call StopVimInTerminal(buf)
36 call delete('Xeuc_jp.txt')
Bram Moolenaar617d7ef2019-01-17 13:04:30 +010037endfunc
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +020038
39" vim: shiftwidth=2 sts=2 expandtab