From 8a86d4f72ff1d6f55c82b8f8fd5af3373d2e3f87 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Mon, 18 Jun 2018 21:37:06 -0500 Subject: [PATCH] common: Use UTF-8 server encoding by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Switch to UTF-8 as default codec for server. This fixes non-ASCII characters in /away messages and other situations silently being converted to question marks. Don't modify default Decoding codec as UTF-8 is automatically used there when needed. Update tooltips to offer guidance on restoring server encoding. NOTE 1: If client is upgraded without core being upgraded, client will wrongly show UTF-8 as the default for server encoding. The older core still uses the past encoding, and manually specifying UTF-8 as the selected encoding still works. NOTE 2: This affects all networks that have not yet set a custom encoding. A migration would require core-side in-database settings versioning and reading/writing from database. It might be better to mention this on the release notes. This is a matter of trade-offs. Invalid encoding can result in error messages or server disconnecting, confusing but noisy. However, too limited of an encoding simply silently converts characters to question marks, in e.g. /away messages or nicks. No warnings are printed. Is the IRC world ready for UTF-8 by default as a server encoding? Well.. that's hard to say. This can be overridden per-network (even with an old client!), and this commit is also easily reverted. It's probably worthwhile trying in beta, reverting before release if too many things break. IRC servers should at least provide error messages. (I personally think it's time to switch. Partially since it took me 1-2 years before finding out this is why I couldn't join UTF-8 channels on a certain network. And it's still confusing people today with e.g. non-ASCII in /away messages.) Thanks to @disconsented for bringing this issue to attention again. Test results for Freenode (a partially UTF-8 server network): > Before /join ##test♪ [8:18:31 pm] --> digitalcircuit (...) has joined ##test? /nick digitalcircuit♪ [8:19:06 pm] * No free and valid nicks in nicklist found. use: /nick to continue [8:19:06 pm] * Nick digitalcircuit? contains illegal characters /away Now playing ♪ Songs to Test [8:21:11 pm] * You have been marked as being away /whois digitalcircuit [8:21:18 pm] * [Whois] digitalcircuit is away: "Now playing ? Songs to Test" > After /join ##test♪ [8:16:57 pm] * 479 ##test♪ Illegal channel name /nick digitalcircuit♪ [8:17:39 pm] * No free and valid nicks in nicklist found. use: /nick to continue [8:17:39 pm] * Nick digitalcircuit�� contains illegal characters /away Now playing ♪ Songs to Test [8:21:46 pm] * You have been marked as being away /whois digitalcircuit [8:22:12 pm] * [Whois] digitalcircuit is away: "Now playing ♪ Songs to Test" --- src/common/quassel.cpp | 2 +- src/qtui/settingspages/networkssettingspage.ui | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 4e24ff0a..86ab48b7 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -104,7 +104,7 @@ bool Quassel::init() instance()->setupEnvironment(); instance()->registerMetaTypes(); - Network::setDefaultCodecForServer("ISO-8859-1"); + Network::setDefaultCodecForServer("UTF-8"); Network::setDefaultCodecForEncoding("UTF-8"); Network::setDefaultCodecForDecoding("ISO-8859-15"); diff --git a/src/qtui/settingspages/networkssettingspage.ui b/src/qtui/settingspages/networkssettingspage.ui index 8426dd0c..7e6ad135 100644 --- a/src/qtui/settingspages/networkssettingspage.ui +++ b/src/qtui/settingspages/networkssettingspage.ui @@ -971,8 +971,7 @@ This setting defines the encoding for messages that are not UTF-8. - This specifies how control messages, nicks and servernames are encoded. -Unless you *really* know what you do, leave this as ISO-8859-1! + <qt><p>This specifies how control messages, nicks and servernames are encoded.</p><p><b>UTF-8</b> should be fine for modern networks. On other networks, you may need to use <b>ISO-8859-1</b> to avoid errors with illegal characters and invalid encoding.</p></qt> Server encoding: @@ -985,8 +984,7 @@ Unless you *really* know what you do, leave this as ISO-8859-1! true - This specifies how control messages, nicks and servernames are encoded. -Unless you *really* know what you do, leave this as ISO-8859-1! + <qt><p>This specifies how control messages, nicks and servernames are encoded.</p><p><b>UTF-8</b> should be fine for modern networks. On other networks, you may need to use <b>ISO-8859-1</b> to avoid errors with illegal characters and invalid encoding.</p></qt> -- 2.20.1