common: Use UTF-8 server encoding by default
authorShane Synan <digitalcircuit36939@gmail.com>
Tue, 19 Jun 2018 02:37:06 +0000 (21:37 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Jun 2018 21:59:39 +0000 (23:59 +0200)
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 <othernick> 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 <othernick> 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
src/qtui/settingspages/networkssettingspage.ui

index 4e24ff0..86ab48b 100644 (file)
@@ -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");
 
index 8426dd0..7e6ad13 100644 (file)
@@ -971,8 +971,7 @@ This setting defines the encoding for messages that are not UTF-8.</string>
                <item row="2" column="0">
                 <widget class="QLabel" name="label_9">
                  <property name="toolTip">
-                  <string>This specifies how control messages, nicks and servernames are encoded.
-Unless you *really* know what you do, leave this as ISO-8859-1!</string>
+                  <string>&lt;qt&gt;&lt;p&gt;This specifies how control messages, nicks and servernames are encoded.&lt;/p&gt;&lt;p&gt;&lt;b&gt;UTF-8&lt;/b&gt; should be fine for modern networks.  On other networks, you may need to use &lt;b&gt;ISO-8859-1&lt;/b&gt; to avoid errors with illegal characters and invalid encoding.&lt;/p&gt;&lt;/qt&gt;</string>
                  </property>
                  <property name="text">
                   <string>Server encoding:</string>
@@ -985,8 +984,7 @@ Unless you *really* know what you do, leave this as ISO-8859-1!</string>
                   <bool>true</bool>
                  </property>
                  <property name="toolTip">
-                  <string>This specifies how control messages, nicks and servernames are encoded.
-Unless you *really* know what you do, leave this as ISO-8859-1!</string>
+                  <string>&lt;qt&gt;&lt;p&gt;This specifies how control messages, nicks and servernames are encoded.&lt;/p&gt;&lt;p&gt;&lt;b&gt;UTF-8&lt;/b&gt; should be fine for modern networks.  On other networks, you may need to use &lt;b&gt;ISO-8859-1&lt;/b&gt; to avoid errors with illegal characters and invalid encoding.&lt;/p&gt;&lt;/qt&gt;</string>
                  </property>
                 </widget>
                </item>