To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.
Charset: Difference between revisions
DarthGandalf (talk | contribs) No edit summary |
Update to latest version provided by archive.org |
||
Line 1: | Line 1: | ||
ZNC | ZNC has supported character encodings in core since [[ChangeLog/1.6.0|1.6.0]]. If you want to look at the earlier "charset" module, it's located at [[Charset/old]]. ZNC uses UTF-8 internally. You can configure charset used between ''clients and ZNC'', and charset used between ''ZNC and the IRC server''. Likely values are <code>UTF-8</code> and <code>ISO-8859-1</code>, but you might need other [[wikipedia:Character encoding#Common character encodings|common character encodings]]. | ||
= Prerequisites = | = Prerequisites = | ||
[http://site.icu-project.org/ ICU library] does the actual conversion. If it's available, <code>./configure</code> will find it. | [http://site.icu-project.org/ ICU library] does the actual conversion. If it's available, <code>./configure</code> will find it. | ||
= | = Configure via Web Admin = | ||
[[Image:Charset2.png|frame]] | [[Image:Charset2.png|frame]][[Image:Charset1.png|frame]] | ||
[[Image:Charset1.png|frame]] | GUI is available in [[webadmin]] on both ''User Settings'' pages (''Client Encoding'', between the user's client and ZNC) and ''Network Settings'' pages (''Server Encoding'', between ZNC and the IRC server). | ||
If one of "Try UTF-8 and ___" options is selected, when ZNC receives a line from socket (either client, or server), at first it checks whether it's valid UTF-8, or not. If it's not, the fallback charset is used to decode the line. | If one of the "Try to parse as UTF-8 and ___" options is selected, when ZNC receives a line from socket (either client, or server), at first it checks whether it's valid UTF-8, or not. If it's not, the fallback charset is used to decode the line. | ||
* After changing the ''Client Encoding'' on the user settings page, the user must reconnect their client to ZNC for settings to take effect. | |||
* After changing the ''Server Encoding'' on the network settings page, ZNC must be reconnected to the IRC server for settings to take effect, for example by typing <code>/msg *status Connect</code>. | |||
<div style="clear:both"></div> | |||
= Configure via Control Panel module = | |||
Make sure the [[controlpanel]] module is enabled. The following commands are available: | |||
:<code>/msg *controlpanel Set ClientEncoding <user> <value></code> | |||
:<code>/msg *controlpanel SetNetwork Encoding <user> <network> <value></code> | |||
The <code><value></code> comes in 4 flavors, which map to 4 options in webadmin: | |||
* <code></code> (empty): Don't ensure any encoding at all (legacy mode, not recommended) | |||
* <code>^foo</code>: Try to parse as UTF-8 and as <code>foo</code>, send as UTF-8 (recommended) | |||
* <code>*foo</code>: Try to parse as UTF-8 and as <code>foo</code>, send as <code>foo</code> | |||
* <code>foo</code>: Parse and send as <code>foo</code> only. | |||
If one of the "Try to parse as UTF-8 and ___" options is used (by prepending '''^''' or '''*''' to the value), when ZNC receives a line from socket (either client, or server), at first it checks whether it's valid UTF-8, or not. If it's not, the fallback charset is used to decode the line. | |||
==Examples== | |||
; To set the encoding between user ''Kathryn'''s client and ZNC to "''Try to parse as UTF-8 and as <code>ISO-8859-15</code>, send as UTF-8 (recommended)''," you would use: | |||
: <code>/msg *controlpanel Set ClientEncoding Kathryn ^ISO-8859-15</code> | |||
: …and then user ''Kathryn'' would have to reconnect her client to ZNC. | |||
; To set user ''Kathryn'''s encoding between ZNC and the IRC network named ''freenodeIRC'' to "''Try to parse as UTF-8 and as <code>UTF-8</code>, send as UTF-8 (recommended)''," you would use: | |||
: <code>/msg *controlpanel SetNetwork Encoding Kathryn freenodeIRC ^UTF-8</code> | |||
: …and then ZNC would have to reconnect to network ''freenodeIRC'', for example by typing <code>/msg *status Connect</code> |
Revision as of 14:54, 31 March 2017
ZNC has supported character encodings in core since 1.6.0. If you want to look at the earlier "charset" module, it's located at Charset/old. ZNC uses UTF-8 internally. You can configure charset used between clients and ZNC, and charset used between ZNC and the IRC server. Likely values are UTF-8
and ISO-8859-1
, but you might need other common character encodings.
Prerequisites
ICU library does the actual conversion. If it's available, ./configure
will find it.
Configure via Web Admin
GUI is available in webadmin on both User Settings pages (Client Encoding, between the user's client and ZNC) and Network Settings pages (Server Encoding, between ZNC and the IRC server).
If one of the "Try to parse as UTF-8 and ___" options is selected, when ZNC receives a line from socket (either client, or server), at first it checks whether it's valid UTF-8, or not. If it's not, the fallback charset is used to decode the line.
- After changing the Client Encoding on the user settings page, the user must reconnect their client to ZNC for settings to take effect.
- After changing the Server Encoding on the network settings page, ZNC must be reconnected to the IRC server for settings to take effect, for example by typing
/msg *status Connect
.
Configure via Control Panel module
Make sure the controlpanel module is enabled. The following commands are available:
/msg *controlpanel Set ClientEncoding <user> <value>
/msg *controlpanel SetNetwork Encoding <user> <network> <value>
The <value>
comes in 4 flavors, which map to 4 options in webadmin:
(empty): Don't ensure any encoding at all (legacy mode, not recommended)
^foo
: Try to parse as UTF-8 and asfoo
, send as UTF-8 (recommended)*foo
: Try to parse as UTF-8 and asfoo
, send asfoo
foo
: Parse and send asfoo
only.
If one of the "Try to parse as UTF-8 and ___" options is used (by prepending ^ or * to the value), when ZNC receives a line from socket (either client, or server), at first it checks whether it's valid UTF-8, or not. If it's not, the fallback charset is used to decode the line.
Examples
- To set the encoding between user Kathryn's client and ZNC to "Try to parse as UTF-8 and as
ISO-8859-15
, send as UTF-8 (recommended)," you would use /msg *controlpanel Set ClientEncoding Kathryn ^ISO-8859-15
- …and then user Kathryn would have to reconnect her client to ZNC.
- To set user Kathryn's encoding between ZNC and the IRC network named freenodeIRC to "Try to parse as UTF-8 and as
UTF-8
, send as UTF-8 (recommended)," you would use /msg *controlpanel SetNetwork Encoding Kathryn freenodeIRC ^UTF-8
- …and then ZNC would have to reconnect to network freenodeIRC, for example by typing
/msg *status Connect