summary refs log tree commit diff stats
path: root/src/common/plugin.c
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2015-01-18 02:10:04 -0800
committerArnavion <arnavion@gmail.com>2015-01-18 02:10:04 -0800
commit5749c53484369515c4e6df4a4730b1f34fab82b4 (patch)
tree8ba88feef1e6086981f8add539572d6cd0b142c2 /src/common/plugin.c
parent5569205d1578f46a4ba4a2b23d8e48a933acd6ce (diff)
Server line text-encoding-related fixes.
- Handle server lines that contain sequences which are invalid in the server encoding. Previously, these would cause the whole line to be interpreted in ISO-8859-1, but now they're simply replaced with an appropriate replacement character.

- Removed prefs.utf8_locale.

- Change default server encoding from system locale to UTF-8.

- Always populate server->encoding with a non-null value - UTF-8.

Fixes #1198
Diffstat (limited to 'src/common/plugin.c')
-rw-r--r--src/common/plugin.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index b0eef41d..5ef20de8 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -970,9 +970,7 @@ hexchat_printf (hexchat_plugin *ph, const char *format, ...)
 void
 hexchat_command (hexchat_plugin *ph, const char *command)
 {
-	char *command_nonconst;
-	char *conv;
-	gssize len = -1;
+	char *command_utf8;
 
 	if (!is_session (ph->context))
 	{
@@ -981,11 +979,9 @@ hexchat_command (hexchat_plugin *ph, const char *command)
 	}
 
 	/* scripts/plugins continue to send non-UTF8... *sigh* */
-	command_nonconst = g_strdup (command);
-	conv = text_validate (&command_nonconst, &len);
-	handle_command (ph->context, command_nonconst, FALSE);
-	g_free (conv);
-	g_free (command_nonconst);
+	command_utf8 = text_invalid_encoding_to_utf8 (command, -1, "UTF-8", NULL);
+	handle_command (ph->context, command_utf8, FALSE);
+	g_free (command_utf8);
 }
 
 void