diff --git a/src/chars.c b/src/chars.c index fcbc9f4f..9ea0bc07 100644 --- a/src/chars.c +++ b/src/chars.c @@ -712,17 +712,3 @@ bool is_valid_unicode(wchar_t wc) (0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD)); } #endif - -#ifdef ENABLE_NANORC -/* Check if the string s is a valid multibyte string. Return TRUE if it - * is, and FALSE otherwise. */ -bool is_valid_mbstring(const char *s) -{ -#ifdef ENABLE_UTF8 - if (use_utf8) - return (mbstowcs(NULL, s, 0) != (size_t)-1); - else -#endif - return TRUE; -} -#endif /* ENABLE_NANORC */ diff --git a/src/proto.h b/src/proto.h index 399725a8..30d18a75 100644 --- a/src/proto.h +++ b/src/proto.h @@ -236,9 +236,6 @@ bool has_blank_mbchars(const char *s); #ifdef ENABLE_UTF8 bool is_valid_unicode(wchar_t wc); #endif -#ifdef ENABLE_NANORC -bool is_valid_mbstring(const char *s); -#endif /* Most functions in color.c. */ #ifdef ENABLE_COLOR diff --git a/src/rcfile.c b/src/rcfile.c index 2e6675ea..4ab8241f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1085,12 +1085,13 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) #ifdef DEBUG fprintf(stderr, " Option argument = \"%s\"\n", option); #endif - /* Make sure the option argument is a valid multibyte string. */ - if (!is_valid_mbstring(option)) { +#ifdef ENABLE_UTF8 + /* When in a UTF-8 locale, ignore arguments with invalid sequences. */ + if (using_utf8() && mbstowcs(NULL, option, 0) == (size_t)-1) { rcfile_error(N_("Argument is not a valid multibyte string")); continue; } - +#endif #ifdef ENABLE_COLOR if (strcasecmp(rcopts[i].name, "titlecolor") == 0) color_combo[TITLE_BAR] = parse_interface_color(option);