1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 00:33:13 +02:00

irc: fix display of invalid UTF-8 chars in raw buffer

Invalid UTF-8 chars are now displayed as hexadecimal codes, for example:
"test\xE9" instead of "test?" (the real word being "testé").
This commit is contained in:
Sébastien Helleu
2015-08-22 08:53:33 +02:00
parent 0513800cb6
commit 2c4b0e32ec
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -238,7 +238,9 @@ irc_raw_message_add (struct t_irc_server *server, int flags,
pos_buf2 = 0;
while (ptr_buf[pos_buf])
{
if (ptr_buf[pos_buf] < 32)
if ((ptr_buf[pos_buf] < 32)
|| !weechat_utf8_is_valid ((const char *)(ptr_buf + pos_buf),
1, NULL))
{
buf2[pos_buf2++] = '\\';
buf2[pos_buf2++] = 'x';