Article View: news.software.readers
Article #260751Re: [Dialog] Unicode capabilities
From: Michael Bäuerle
Date: Sun, 17 Jul 2016 17:56
Date: Sun, 17 Jul 2016 17:56
157 lines
7884 bytes
7884 bytes
Adam H. Kerman wrote: >Michael <michael.baeuerle@gmx.net> wrote: >>Adam H. Kerman wrote: >>> >>>[...] >>>A sanity check is required first before attempting conversion. Was the >>>MIME header standard to begin with? I'd never make that assumption. >>If an article is not broken, the "Charset" parameter of the >>"Content-Type" header field declares the charset for the body (and >>only the body, potential 'encoded-words' in the header have their own >>character set labels and are independent units). >I'm not discussing the use of encoded words [...] >I'm still discussing whether the character set declaration of the >precursor article was correct to begin with. >It is my contention that the character set declaration is likely to be >correct ONLY for the portions of the body written by the author and not >for quoted or re-quoted text. Other people cannot be relied upon to >convert correctly or to have quoted correctly. This was the case in the broken, trn produced article I have linked as example. But according to MIME the whole body has to have the same encoding. >Worse, still, are quotes of copied-n-pasted material from the Web, >which almost no one bothers to translate into plain text, let alone >convert from the Web page's character set to the one declared in the >Usenet article. When copying-n-pasting, the MIME headers are never >copied and the paste function makes its own assumption about what set >the characters being copied are in. Agreed, copy&paste can be more tricky to handle. But in a follow up, the quoted content comes from another article and the newsreader can use its header. For this scenario it should always be clear what character set the quoted content uses. >>If the "Content-Transfer-Encoding" header field is missing (which means >>the same as "7bit") or declare identity (the values "7bit" or "8bit"), >>then the declaration for the charset directly apply to the raw body. >I don't know what the client was suppose to do with the 7bit versus 8bit >declaration when reading an article. The "8bit" declaration can be used e.g. by a mail gateway that sends articles to a moderator via SMTP. If the target protocol can't handle "8bit", the gateway must convert the article (add a transfer-encoding in this case). UTF-7 was invented to avoid this problem for Unicode data, it can be labeled "7bit" and a gateway can transport it directly via SMTP (neither conversion nor SMTP extensions are required). >>Otherwise (for the values "Quoted-Printable" or "Base64") the declared >>transfer-encoding must be decoded first and the declaration of the >>charset apply to the result. >When QP encoding is used, is it supposed to declare 7bit or 8bit? If a real transfer encoding like QP is used, this transfer encoding must be labeled instead of "8bit" in the header. For QP the MIME defined label is "Quoted-Printable". >After all, >the purpose of QP encoding is to annoy every Usenet user given that it's >8 bit clean. The encodings are all sequences of 7bit character. The data created by the two official MIME transfer encodings QP and Base64 is always 7bit (this information is implicit for them). >Plain text should never be encoded on Usenet. Never. MIME was invented for 2 decades old mail systems. Some of its features are rarely required for USENET (and I agree, they should not be used if not required). >>Non-identity transfer encoding in the body is normally never used by >>real newsreaders, only by mail clients (because SMTP without extensions >>is a 7bit protocol). >>In other words: >>If there is no non-identity transfer encoding declared, the raw body and >>the charset declared in the "Content-Type" header field can be used as >>input and source character set for iconv. >I'm lost here. Are you talking about proprietary Microsoft crap like >Winmail.dat format? No. For an article with such fields in the header: Content-Transfer-Encoding: 8bit Content-Type: text/plain; Charset=UTF-8 they mean "there is *no* transfer encoding used for the body, but it requires an 8bit capable transport protocol" and "the body uses UTF-8 instead of the default US-ASCII encoding". If the body uses UTF-7 encoding, the Content-Transfer-Encoding-Field can be omitted: Content-Type: text/plain; Charset=UTF-7 because the default "7bit" is sufficient for transport. There are other character sets like ISO 2022-JP (for Japanese) that don't require 8bit transport protocols. >>>Also, you just have to start by assuming that the character set declared >>>in the MIME header applies to the new portions of the body and not >>>the quoted portions. >>In the example article the locale of the user seem to be configured to >>use ISO 8859-1 encoding (anything typed into the text editor will get >>this encoding). >Are you talking about your trn4 example? Yes. >trn4 wouldn't check locale environmentvariables natively. But the text editor of a german user should do. If a script executed by trn prepares the data in the locales charset, the text editor should handle it correctly. >>If the quoted data was converted to ISO 8859-1 (before the editor was >>started), the encoding of both parts would have matched. >That's a lot of ifs. As a third party just reading Usenet, it's not safe >for me to have made that assumption when posting a followup. >>Looking at this thread, there are some articles that contains characters >>that can't be represented with ISO 8859-1. To avoid the situation >>"source charset is supported, but conversion to target charset is not >>possible" and the situation "user can't type something because the >>target charset doesn't support it" flnews always convert the quoted data >>to Unicode and the text editor must use UTF-8. The normalization and >>conversion to the final character set is done after the editor was >>closed. >What do you do in the not atypical situation in which the character set >of the quoted quote isn't obvious due to nontranslation along the way? I >have walked back along the article tree to check MIME headers of the >author's own article. If the content has wrong MIME declarations or encodings are mixed, I try to repair the crippled parts manually in the text editor. Things like crippled Umlauts can be repaired directly from the quoted context. Otherwise I go back in the article tree and view the original data too. Some newsreaders, like the Mozilla programs, try hard to guess the intended meaning of wrong declared or encoded data. And they are good, in most of the common cases they do the right thing. flnews do not guess (by intent - if it's broken, I want to see that it's broken).
Technical Details
Message-ID:
<AABXi8bTOjsAAEyi.A1.flnews@WStation4.micha.freeshell.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mailReferences:
<nli1e8$hi6$1@news.mixmin.net> <AABXigTa+nYAAFHc.A1.flnews@WStation4.micha.freeshell.org> <nmdjs4$lhp$2@news.albasani.net> <AABXi1QnTH4AAEOm.A1.flnews@WStation4.micha.freeshell.org> <nmg79v$mik$1@news.albasani.net>Show Full Headers
Complete Article Headers
Message-ID: <AABXi8bTOjsAAEyi.A1.flnews@WStation4.micha.freeshell.org> Subject: Re: [Dialog] Unicode capabilities Date: Sun, 17 Jul 2016 17:56:35 -0000 From: Michael Bäuerle <michael.baeuerle@gmx.net> References: <nli1e8$hi6$1@news.mixmin.net> <AABXigTa+nYAAFHc.A1.flnews@WStation4.micha.freeshell.org> <nmdjs4$lhp$2@news.albasani.net> <AABXi1QnTH4AAEOm.A1.flnews@WStation4.micha.freeshell.org> <nmg79v$mik$1@news.albasani.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.(126883).mbox.7z!not-for-mail Newsgroups: news.software.readers Lines: 157 Mime-Version: 1.0 X-Trace: individual.net etmTovC2ebrxi4GJ2sWwbAxy9ctRcZWH7FdeIaweUzReYFb/9P X-Orig-Path: not-for-mail Cancel-Lock: sha1:BLCsijGEzXWW360uHVT2ZiSIP+4= sha1:SCVAR4RWxYITeuGsmtgiPplP930= Injection-Date: Sun, 17 Jul 2016 17:56:35 -0000 User-Agent: flnews/0.14pre44 (for AIX) X-Received-Body-CRC: 1809294522 X-Received-Bytes: 7739