mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 21:55:17 -07:00
set_init_1: mb_init() on fallback encoding (utf8) #2106
Explanation: Running `:set encoding=utf-8` _after_ startup correctly initializes multibyte; but mb_init() was _not_ called during startup if locale detection (enc_locale()) failed. This wasn't a problem in Vim because the Vim default encoding (latin1) does not require mb_init(). But Nvim defaults to utf8, so mb_init() is required. closes #1271 closes #1672
This commit is contained in:
parent
85f5115723
commit
57811dec95
@ -1989,7 +1989,7 @@ void set_init_1(void)
|
||||
char_u *save_enc;
|
||||
|
||||
/* Try setting 'encoding' and check if the value is valid.
|
||||
* If not, go back to the default "latin1". */
|
||||
* If not, go back to the default "utf-8". */
|
||||
save_enc = p_enc;
|
||||
p_enc = p;
|
||||
if (STRCMP(p_enc, "gb18030") == 0) {
|
||||
@ -2029,8 +2029,13 @@ void set_init_1(void)
|
||||
|
||||
} else {
|
||||
free(p_enc);
|
||||
// mb_init() failed; fallback to utf8 and try again.
|
||||
p_enc = save_enc;
|
||||
mb_init();
|
||||
}
|
||||
} else {
|
||||
// enc_locale() failed; initialize the default (utf8).
|
||||
mb_init();
|
||||
}
|
||||
|
||||
/* Set the default for 'helplang'. */
|
||||
|
Loading…
Reference in New Issue
Block a user