Article View: news.software.nntp
Article #86747Unicode in USENET article headers
From: Michael Baeuerle
Date: Thu, 07 May 2015 13:26
Date: Thu, 07 May 2015 13:26
137 lines
7385 bytes
7385 bytes
Current situation: RFC5536 [1] define the whole header as US-ASCII encoded. If an article header should contain something else, MIME (RFC2047 [2]) transfer encoding is required to produce a standard compliant article. Problem: MIME encoded words are ugly and complicate to handle. People want an easier way to implement agents. Possible solutions for future article standard: S1) Redefine the whole header and allow to use Unicode in UTF-8 transformation format. S2) Redefine only parts of the header to do so. In this case the question is what parts should be Unicode and which parts should not. The potential problem with both variants is, that Unicode is an ambigous encoding with canonically equivalence as fundamental design principle. The tests below revealed, that there may be issues that can break compatibility with existing software if this is simply ignored (and data is not handled as Unicode string [5] but instead as an octet or Unicode codepoint sequence). The goal ist to give an overview of the potential problems and to discuss how they can be mitigated to preserve an acceptable level of backward compatibility. The test articles can be found in [3] and three other groups that have canonically equivalent names. A fourth group [4] exist with a name for which Unicode define exactly one valid codepoint sequence (this include the fact, that normalization forms C and D are the same for this name). ======================================================================== Potential problems: P1) Compare may fail / Identifiers may be ambigous The most relevant identifiers in article headers are: - Message-IDs - Newsgroup lists Unicode defines how to normalize strings so that they can be compared as octet streams [5]. Current standards [6] recommend (but not mandate!) to apply normalization form C (NFC) to all Unicode data before transmission. P2) Missing or wrong normalization Because Unicode normalization is not less complicated than MIME, it is likely that this (working) solution is ignored or not implemented correctly. P3) Identifiers defined as "not Unicode strings" If identifiers (and data in general) are considered to be Unicode compliant codepoint sequences, but not Unicode strings with the defined semantics, problems will occur if any part of an agent uses components (libraries, filesystems, etc.) that don't follow this definition but use Unicode strings with the defined semantics. See the following example. ======================================================================== Example: Apple machines (at least on HFS+ [7] filesystems) use Unicode strings as filenames [8][9][10]. This means that inside a directory there can't be multiple files/subdirectories with canonically equivalent names. And this means, that the created filename may not be the same octet stream and not even the same Unicode codepoint sequence if read back from the filesystem. Generic normalization before creating the name don't change this, because neither NFC nor NFD is used internally by the HFS+ filesystem. If any agent use such a filesystem as database with elements named after identifiers from article headers, the database gets corrupted if canonically equivalent Unicode identifiers are used for different items. That other canonically equivalent representations exist is sufficient for the failure, corresponding items don't have to be present. In the test group [3], there are screenshots that show the result of a corrupted header cache triggered by the canonically equivalent group names (article header and body are displayed together that are unrelated over group boundaries). It is likely that the same problem will occur if the spool directory for leafnode [11] is placed on a HFS+ filesystem. Note that this example is platform dependent and the problem is completely invisible on e.g. ext2/3/4 filesystems on GNU/Linux. ======================================================================== Some possible mitigations: M1) Use Unicode strings (respect canonically equivalence as defined) Unicode is well defined and if normalization would be mandatory for all agents, at least such problems as in the example above can not occur. This would match S1 above and work for the whole header (including the field names), but may break backward compatibility if really used everywhere. M2) Write/change software to handle identifiers not as Unicode strings with the defined semantics, but in a different suitable way instead. Care must be taken to hold away the data from other modules that use Unicode semantics. For the example above, this would not be hard. A transfer encoding like base64 can be applied to the directory names in the header cache, so that they look like US-ASCII for the filesystem with Unicode semantics. According to Dennis, the tin newsreader use some kind of hash algorithm for this purpose. Can be combined with S1 and S2 above. But existing software that is unmaintained may be (and stay) broken. M3) Only allow Unicode for selected header fields without identifiers Some header fields are not relevant for transport and normally are not used as identifiers at all (e.g. "Subject" may only be used as identifier if threading after "References" failed). Any valid Unicode codepoint sequence in UTF-8 representation should simply work here. Would match S2 above and provide better backward compatibility. M4) Stay with RFC2047 transfer encoding Ugly, but it works. Now widely supported after more than a decade. Comments are welcome. ______________ [1] <https://tools.ietf.org/html/rfc5536> [2] <https://tools.ietf.org/html/rfc2047> [3] <nntp://news.trigofacile.com/trigofacile.test.%E1%BE%85> [4] <nntp://news.trigofacile.com/trigofacile.test.%CF%85%CF%84%CF%868> [5] <http://www.unicode.org/reports/tr15> [6] <https://tools.ietf.org/html/rfc5198> [7] <http://www.applexsoft.com/glossary/hfs-plus.html> [8] <http://unicodebook.readthedocs.org/en/latest/operating_systems.html#mac-os-x> [9] <https://developer.apple.com/library/mac/qa/qa1173/_index.html> [10] <https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#UnicodeSubtleties> [11] <http://leafnode.sourceforge.net>
Technical Details
Message-ID:
<AABVSz44XaQAABwE.A1.flnews@WStation3.stz-e.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20150601.mbox.gz!border1.nntp.dca1.giganews.com!nntp.giganews.com!v13no23663733lbi.0!news-out.google.com!ul5ni191890lbb.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <AABVSz44XaQAABwE.A1.flnews@WStation3.stz-e.de> Subject: Unicode in USENET article headers Date: Thu, 07 May 2015 13:26:56 +0000 From: Michael Baeuerle <michael.baeuerle@stz-e.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20150601.mbox.gz!border1.nntp.dca1.giganews.com!nntp.giganews.com!v13no23663733lbi.0!news-out.google.com!ul5ni191890lbb.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail X-Received: by 10.180.10.136 with SMTP id i8mr2096637wib.7.1431005267236; Newsgroups: news.software.nntp Lines: 137 Reply-To: Michael Baeuerle <michael.baeuerle@gmx.net> Mime-Version: 1.0 X-Trace: individual.net 4RJ8FESmW076oqD7jauHTQckkdRZpwIWX5SjhnwA/ABqIgyTHO X-Orig-Path: not-for-mail Cancel-Lock: sha1:bdjOH7uVMrnSvaA74ywYI5evXko= sha1:HyeEFCmy8pnz5ZR6JBAFEZU5yH4= Injection-Date: 7 May 2015 13:26:56 -0000 User-Agent: flnews/0.11pre16 (for GNU/Linux)