Trying to connect to irc.friend-chat.jp:6664 with znc as a bouncer but could not set it up to decode ISO-2022-JP properly. I have searched for similar issues here and the most common mistake people make is the Network Encoding setup, and here is my setup.
Yep, ^iso-2022-jp does not work, but iso-2022-jp does, and even provides better results than your paste from irssi - one of strings there is malformed: (自動的にFriend Chat IRCのサーバー群の1台に振り分けられます)��] - note the � at the end.
^ option ("Send as UTF-8, receive as UTF-8 and ____") in ZNC assumes that the non-utf8 encoding is 8-bit, and uses characters outside of ASCII range. E.g. ISO-8859-15 and KOI8-R work that way. ^ follows a simple logic: if the received string can be parsed as correct UTF-8, it assumes that it is UTF-8, otherwise it falls back to the other encoding.
ISO-2022-JP is different, because it doesn't use characters outside of ASCII range, so the strings looks like it's UTF-8, and ZNC parser doesn't even attempt ISO-2022-JP on it.
It look like irssi attempts ISO-2022-JP first, and that's why it shows the malformed string as $B!J<+F0E*$K(BFriend - because it was failed to parse as ISO-2022-JP, but succeeded as UTF-8.
But parsing it this way won't work encodings like ISO-8859-15. Does irssi hardcode list of encodings somewhere, to know what to attempt first - UTF-8 or the other one?
I didn't look at irssi implementation yet, but here's a random idea: what about another set of options which mean "Send as __, receive as ___ and UTF-8" and "Send as UTF-8, receive as ___ and UTF-8" in addition to existing ^ and *.
WDYT?
Yep, `^iso-2022-jp` does not work, but `iso-2022-jp` does, and even provides better results than your paste from irssi - one of strings there is malformed: `(自動的にFriend Chat IRCのサーバー群の1台に振り分けられます)��]` - note the � at the end.
`^` option ("Send as UTF-8, receive as UTF-8 and ____") in ZNC assumes that the non-utf8 encoding is 8-bit, and uses characters outside of ASCII range. E.g. `ISO-8859-15` and `KOI8-R` work that way.
`^` follows a simple logic: if the received string can be parsed as correct UTF-8, it assumes that it is UTF-8, otherwise it falls back to the other encoding.
`ISO-2022-JP` is different, because it doesn't use characters outside of ASCII range, so the strings looks like it's UTF-8, and ZNC parser doesn't even attempt `ISO-2022-JP` on it.
It look like irssi attempts `ISO-2022-JP` first, and that's why it shows the malformed string as `$B!J<+F0E*$K(BFriend` - because it was failed to parse as `ISO-2022-JP`, but succeeded as UTF-8.
But parsing it this way won't work encodings like `ISO-8859-15`. Does irssi hardcode list of encodings somewhere, to know what to attempt first - UTF-8 or the other one?
I didn't look at irssi implementation yet, but here's a random idea: what about another set of options which mean "Send as __, receive as ___ and UTF-8" and "Send as UTF-8, receive as ___ and UTF-8" in addition to existing `^` and `*`.
WDYT?
<!-- github-comment-id:354875372 -->
I think that's a great idea and I believe it will solve the issue quite well.
Now I see how decoding works in znc and understand clearly why this happens.
And if I understood correctly the malformed string in MOTD (utf-8 string inside of iso-2022-jp) is a fault of friend-chat server admins, so I would have to contact them if I want to change it, correct?
Thanks for your quick and thoughtful response.
I think that's a great idea and I believe it will solve the issue quite well.
Now I see how decoding works in znc and understand clearly why this happens.
And if I understood correctly the malformed string in MOTD (utf-8 string inside of iso-2022-jp) is a fault of friend-chat server admins, so I would have to contact them if I want to change it, correct?
<!-- github-comment-id:354919807 -->
Your immediate issue can already be solved on your side, by removing ^ character, or by using webadmin to configure encoding, which makes it more clear what ^ means. Also see this wiki page.
The rest is only about mixing UTF-8 and ISO-2022-JP in a single connection.
I would have to contact them if I want to change it, correct?
Yes
the malformed string in MOTD (utf-8 string inside of iso-2022-jp)
No. That string is not UTF-8, because it looks gibberish when parsed as UTF-8. But:
it is "valid" UTF-8, as in, it is parseable as UTF-8 string at all. This is a property of ISO-2022-JP which uses 7-bit characters. It's possible for it to use 8th bit, but it's not necessary, and the string server sends is not using the 8th bit, which is fine. But all ASCII characters are valid UTF-8, which makes all those strings parseable as UTF-8, even if its meaning for humans is lost.
that exact line is not valid ISO-2022-JP, because it ends in middle of an escape sequence. I believe they meant BB from the next line to be continuation of the same line. That would make it valid. The same split applies to 2 other lines in that MOTD, but there breakage is not that visible, because it happened right before start of next escape sequence.
Your immediate issue can already be solved on your side, by removing `^` character, or by using webadmin to configure encoding, which makes it more clear what `^` means. Also see [this wiki page](https://wiki.znc.in/Charset).
The rest is only about mixing UTF-8 and ISO-2022-JP in a single connection.
> I would have to contact them if I want to change it, correct?
Yes
> the malformed string in MOTD (utf-8 string inside of iso-2022-jp)
No. That string is not UTF-8, because it looks gibberish when parsed as UTF-8. But:
* it is "valid" UTF-8, as in, it is parseable as UTF-8 string at all. This is a property of ISO-2022-JP which uses 7-bit characters. It's possible for it to use 8th bit, but it's not necessary, and the string server sends is not using the 8th bit, which is fine. But all ASCII characters are valid UTF-8, which makes all those strings parseable as UTF-8, even if its meaning for humans is lost.
* that exact line is not valid ISO-2022-JP, because it ends in middle of an escape sequence. I believe they meant `BB` from the next line to be continuation of the same line. That would make it valid. The same split applies to 2 other lines in that MOTD, but there breakage is not that visible, because it happened right before start of next escape sequence.
<!-- github-comment-id:354957559 -->
Ah, setting network encoding setting to iso-2022-jp and restarting znc solved the issue. Thanks.
I see now that znc not decoding malformed iso-2022-jp in MOTD as a iso-2022-jp is a separate issue so I will leave this issue open. My original issue is solved now so you can close this issue if you want.
Thanks again for all the help!
Ah, setting network encoding setting to `iso-2022-jp` and restarting znc solved the issue. Thanks.
I see now that znc not decoding malformed iso-2022-jp in MOTD as a iso-2022-jp is a separate issue so I will leave this issue open. My original issue is solved now so you can close this issue if you want.
Thanks again for all the help!
<!-- github-comment-id:354974379 -->
Ah, setting network encoding setting to iso-2022-jp and restarting znc
solved the issue. Thanks.
I see now that znc not decoding malformed iso-2022-jp in MOTD as a
iso-2022-jp is a separate issue so I will leave this issue open. My
original issue is solved now so you can close this issue if you want.
Restarting is not necessary for that.
2018-01-03 10:00 GMT+00:00 qria <notifications@github.com>:
> Ah, setting network encoding setting to iso-2022-jp and restarting znc
> solved the issue. Thanks.
>
> I see now that znc not decoding malformed iso-2022-jp in MOTD as a
> iso-2022-jp is a separate issue so I will leave this issue open. My
> original issue is solved now so you can close this issue if you want.
>
> Thanks again for all the help!
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/znc/znc/issues/1480#issuecomment-354974379>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AAT15GCESnS29SNuK-NZ0AUH69hseINZks5tG0_OgaJpZM4RQgDA>
> .
>
<!-- github-comment-id:354985951 -->
@DarthGandalf Well, now I have a compelling reason to update my instance. Thanks. Guess I've been lazily sitting on 1.6.0 for too long.
@DarthGandalf Well, now I have a compelling reason to update my instance. Thanks. Guess I've been lazily sitting on 1.6.0 for too long.
<!-- github-comment-id:355105996 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Trying to connect to
irc.friend-chat.jp:6664with znc as a bouncer but could not set it up to decodeISO-2022-JPproperly. I have searched for similar issues here and the most common mistake people make is the Network Encoding setup, and here is my setup.Client side encoding is set up to
UTF-8ZNC Version:
ZNC 1.6.5 - http://znc.in
IPv6: yes, SSL: yes, DNS: threads, charset: yes
Here is the MOTD with current ZNC setup
With irssi
/set recode_fallback iso-2022-jpoptionAny way I can further debug this?
Yep,
^iso-2022-jpdoes not work, butiso-2022-jpdoes, and even provides better results than your paste from irssi - one of strings there is malformed:(自動的にFriend Chat IRCのサーバー群の1台に振り分けられます)��]- note the � at the end.^option ("Send as UTF-8, receive as UTF-8 and ____") in ZNC assumes that the non-utf8 encoding is 8-bit, and uses characters outside of ASCII range. E.g.ISO-8859-15andKOI8-Rwork that way.^follows a simple logic: if the received string can be parsed as correct UTF-8, it assumes that it is UTF-8, otherwise it falls back to the other encoding.ISO-2022-JPis different, because it doesn't use characters outside of ASCII range, so the strings looks like it's UTF-8, and ZNC parser doesn't even attemptISO-2022-JPon it.It look like irssi attempts
ISO-2022-JPfirst, and that's why it shows the malformed string as$B!J<+F0E*$K(BFriend- because it was failed to parse asISO-2022-JP, but succeeded as UTF-8.But parsing it this way won't work encodings like
ISO-8859-15. Does irssi hardcode list of encodings somewhere, to know what to attempt first - UTF-8 or the other one?I didn't look at irssi implementation yet, but here's a random idea: what about another set of options which mean "Send as __, receive as ___ and UTF-8" and "Send as UTF-8, receive as ___ and UTF-8" in addition to existing
^and*.WDYT?
Thanks for your quick and thoughtful response.
I think that's a great idea and I believe it will solve the issue quite well.
Now I see how decoding works in znc and understand clearly why this happens.
And if I understood correctly the malformed string in MOTD (utf-8 string inside of iso-2022-jp) is a fault of friend-chat server admins, so I would have to contact them if I want to change it, correct?
Your immediate issue can already be solved on your side, by removing
^character, or by using webadmin to configure encoding, which makes it more clear what^means. Also see this wiki page.The rest is only about mixing UTF-8 and ISO-2022-JP in a single connection.
Yes
No. That string is not UTF-8, because it looks gibberish when parsed as UTF-8. But:
BBfrom the next line to be continuation of the same line. That would make it valid. The same split applies to 2 other lines in that MOTD, but there breakage is not that visible, because it happened right before start of next escape sequence.Ah, setting network encoding setting to
iso-2022-jpand restarting znc solved the issue. Thanks.I see now that znc not decoding malformed iso-2022-jp in MOTD as a iso-2022-jp is a separate issue so I will leave this issue open. My original issue is solved now so you can close this issue if you want.
Thanks again for all the help!
Restarting is not necessary for that.
2018-01-03 10:00 GMT+00:00 qria notifications@github.com:
But reconnecting the network is.
@dgw nope.
@DarthGandalf Well, now I have a compelling reason to update my instance. Thanks. Guess I've been lazily sitting on 1.6.0 for too long.