Fix characters not representable in LC_CTYPE

This commit is contained in:
Přemysl Eric Janouch 2013-05-19 00:12:52 +02:00
parent c09e3dcc96
commit caac68a3ed
1 changed files with 4 additions and 3 deletions

View File

@ -350,7 +350,7 @@ app_add_utf8_string (Application *self, const gchar *str, int n)
g_return_val_if_fail (wide_str != NULL, 0); g_return_val_if_fail (wide_str != NULL, 0);
ssize_t wide_len = wcslen (wide_str); ssize_t wide_len = wcslen (wide_str);
wchar_t padding = L' '; wchar_t padding = L' ', error = L'?';
if (n < 0) if (n < 0)
n = wide_len; n = wide_len;
@ -359,8 +359,9 @@ app_add_utf8_string (Application *self, const gchar *str, int n)
cchar_t cch; cchar_t cch;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
setcchar (&cch, (i < wide_len ? &wide_str[i] : &padding), if (setcchar (&cch, (i < wide_len ? &wide_str[i] : &padding),
A_NORMAL, 0, NULL); A_NORMAL, 0, NULL) == ERR)
setcchar (&cch, &error, A_NORMAL, 0, NULL);
add_wch (&cch); add_wch (&cch);
} }