<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Charset is not set for the &quot;View Source&quot;</title> 
  <pubDate>Fri, 10 Apr 2026 09:35:38 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/11073</link> 
  <atom:link rel="self" type="application/rss+xml" title="Charset is not set for the &quot;View Source&quot;" href="https://bugs.horde.org/ticket/11073/rss" /> 
  <description>Charset is not set for the &quot;View Source&quot;</description> 
 
   
   
  <item> 
   <title>One more needful thing for non-latin alphabet&#039;s users.
When</title> 
   <description>One more needful thing for non-latin alphabet&#039;s users.
When there is generates view of &quot;View Source&quot; [actionID=view_source] there is setting of the content type of &#039;text/plain&#039; without charset.
For correctness file /webroot/imp/view.php, lines after 194 should be:

case &#039;view_source&#039;:
    $msg = $contents-&gt;fullMessageText(array(&#039;stream&#039; =&gt; true));
    rewind($msg);
    while (!feof($msg)) {
        $line=fgets($msg, 4096);
        if ($line !== false){
            if (strlen($line)==0) break 1;
            if (strpos($line ,&quot;charset=&quot;)&gt;0 &amp;&amp; ($pos=strpos($line ,&quot;;&quot;))&gt;0){$ct=substr($line,$pos);break 1;}
        }
    }
    fseek($msg, 0, SEEK_END);
    $headertext=&#039;text/plain&#039;;
    if (isset($ct))$headertext.=$ct;
    $browser-&gt;downloadHeaders(&#039;Message Source&#039;, $headertext, true, ftell($msg));

INSTEAD OF

case &#039;view_source&#039;:
    $msg = $contents-&gt;fullMessageText(array(&#039;stream&#039; =&gt; true));
    fseek($msg, 0, SEEK_END);
    $browser-&gt;downloadHeaders(&#039;Message Source&#039;, &#039;text/plain&#039;, true, ftell($msg));
</description> 
   <pubDate>Tue, 13 Mar 2012 08:59:57 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70692</link> 
  </item> 
   
  <item> 
   <title>&gt; One more needful thing for non-latin alphabet&#039;s users.
&gt; </title> 
   <description>&gt; One more needful thing for non-latin alphabet&#039;s users.
&gt; When there is generates view of &quot;View Source&quot; [actionID=view_source] 
&gt; there is setting of the content type of &#039;text/plain&#039; without charset.
&gt; For correctness file /webroot/imp/view.php, lines after 194 should be:
&gt;
&gt; case &#039;view_source&#039;:
&gt;     $msg = $contents-&gt;fullMessageText(array(&#039;stream&#039; =&gt; true));
&gt;     rewind($msg);
&gt;     while (!feof($msg)) {
&gt;         $line=fgets($msg, 4096);
&gt;         if ($line !== false){
&gt;             if (strlen($line)==0) break 1;
&gt;             if (strpos($line ,&quot;charset=&quot;)&gt;0 &amp;&amp; ($pos=strpos($line 
&gt; ,&quot;;&quot;))&gt;0){$ct=substr($line,$pos);break 1;}
&gt;         }
&gt;     }

No.  A MIME message could theoretically have a different charset for each part - you can&#039;t just choose the first part and use that as the charset.  Additionally, the charset is worthless information since most messages will be encoded in US-ASCII.  The charset parameter of Content-Type deals with the UNencoded data.

To accurately download the contents of a message, you need to use the &quot;Save As&quot; feature.  View Source is not meant to be a canonical representation of the data.</description> 
   <pubDate>Tue, 13 Mar 2012 09:55:32 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70697</link> 
  </item> 
   
  <item> 
   <title>1)Mime message have content type neither a &#039;text/plain&#039; nor </title> 
   <description>1)Mime message have content type neither a &#039;text/plain&#039; nor a &#039;text/html&#039;, but ussually &#039;multipart/mixed&#039; and some others. AND this patch puts charset only for the content type with a charset inside &#039;content type&#039; header, i.e. for &#039;text/plain&#039; and &#039;text/html&#039; !
2)If you are sending just text/plain than Apache adds defaultcharset itself, as I know
3)User offten cant change charset at the browser  (for exaple me)when you are using window without toolbars and menues. Sic!
4)About rare or nor rare cases. Now it is very offten when autogenerated mail goes &quot;Content-encoding: 8bit&quot; with not latin1 and so on with first 7bit chars. Ask more people from not latin alphabet countries.
5)&quot; Save as&quot; is not the best solution, but it works.


&gt;&gt; One more needful thing for non-latin alphabet&#039;s users.
&gt;&gt; When there is generates view of &quot;View Source&quot; [actionID=view_source]
&gt;&gt; there is setting of the content type of &#039;text/plain&#039; without charset.
&gt;&gt; For correctness file /webroot/imp/view.php, lines after 194 should be:
&gt;&gt;
&gt;&gt; case &#039;view_source&#039;:
&gt;&gt;     $msg = $contents-&gt;fullMessageText(array(&#039;stream&#039; =&gt; true));
&gt;&gt;     rewind($msg);
&gt;&gt;     while (!feof($msg)) {
&gt;&gt;         $line=fgets($msg, 4096);
&gt;&gt;         if ($line !== false){
&gt;&gt;             if (strlen($line)==0) break 1;
&gt;&gt;             if (strpos($line ,&quot;charset=&quot;)&gt;0 &amp;&amp; ($pos=strpos($line
&gt;&gt; ,&quot;;&quot;))&gt;0){$ct=substr($line,$pos);break 1;}
&gt;&gt;         }
&gt;&gt;     }
&gt;
&gt; No.  A MIME message could theoretically have a different charset for 
&gt; each part - you can&#039;t just choose the first part and use that as the 
&gt; charset.  Additionally, the charset is worthless information since 
&gt; most messages will be encoded in US-ASCII.  The charset parameter of 
&gt; Content-Type deals with the UNencoded data.
&gt;
&gt; To accurately download the contents of a message, you need to use the 
&gt; &quot;Save As&quot; feature.  View Source is not meant to be a canonical 
&gt; representation of the data.
</description> 
   <pubDate>Tue, 13 Mar 2012 10:16:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70699</link> 
  </item> 
   
  <item> 
   <title>Again, no.  Here&#039;s a message that will be completely broken </title> 
   <description>Again, no.  Here&#039;s a message that will be completely broken in the display:

Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: base64

The output message will be garbage

Here&#039;s another message that will be completely broken:

Content-Type: multipart/mixed; boundary=1

--1
Content-Type: text/plain; charset=iso-8859-1

[Text]

--1
Content-Type: text/plain; charset=utf-8

[Text]

--1--


Again, if you want a quick display of the part&#039;s contents THAT MAY **NOT** BE 100% ACCURATE, you can use View Source.  If you need the EXACT CONTENTS, you MUST use save as.

We do NOT guarantee that View Source outputs an accurate representation of the data.  Because that is impossible to do in the browser (or, for that matter, any text editor).  That&#039;s because MIME messages are NOT designed to be viewed as a single file!  A MIME message != a discrete file as is commonly used in an OS.</description> 
   <pubDate>Tue, 13 Mar 2012 10:53:28 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70701</link> 
  </item> 
   
  <item> 
   <title>1)The difference b/w patched and unpatched version is only t</title> 
   <description>1)The difference b/w patched and unpatched version is only to use charset from headers of message (Not from mime-part cludge inside message as you put on 2-3 example!) instead of charset that Apache will put by default. That is ALL/
2) For your examples: for the first there will be no visible changes, I suppose (as base64 enconding means only 7 bit chars). Anyway it will not be worse than default charset put by webserver.
With second and third examples patch will not alter content type, as I scan only rfc-822 headers (before first empty line) and these charset are out of scope- these are mime&#039;s!


&gt; Again, no.  Here&#039;s a message that will be completely broken in the display:
&gt;
&gt; Content-Type: text/plain; charset=iso-2022-jp
&gt; Content-Transfer-Encoding: base64
&gt;
&gt; The output message will be garbage
&gt;
&gt; Here&#039;s another message that will be completely broken:
&gt;
&gt; Content-Type: multipart/mixed; boundary=1
&gt;
&gt; --1
&gt; Content-Type: text/plain; charset=iso-8859-1
&gt;
&gt; [Text]
&gt;
&gt; --1
&gt; Content-Type: text/plain; charset=utf-8
&gt;
&gt; [Text]
&gt;
&gt; --1--
&gt;
&gt;
&gt; Again, if you want a quick display of the part&#039;s contents THAT MAY 
&gt; **NOT** BE 100% ACCURATE, you can use View Source.  If you need the 
&gt; EXACT CONTENTS, you MUST use save as.
&gt;
&gt; We do NOT guarantee that View Source outputs an accurate 
&gt; representation of the data.  Because that is impossible to do in the 
&gt; browser (or, for that matter, any text editor).  That&#039;s because MIME 
&gt; messages are NOT designed to be viewed as a single file!  A MIME 
&gt; message != a discrete file as is commonly used in an OS.
</description> 
   <pubDate>Tue, 13 Mar 2012 11:14:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70702</link> 
  </item> 
   
  <item> 
   <title>&gt; With second and third examples patch will not alter conten</title> 
   <description>&gt; With second and third examples patch will not alter content type, as 
&gt; I scan only rfc-822 headers (before first empty line) and these 
&gt; charset are out of scope- these are mime&#039;s!

Exactly.  RFC822 Headers MUST be in ASCII.  So sending in US-ASCII (or UTF-8, or ISO-8859-1) is perfectly fine.</description> 
   <pubDate>Wed, 14 Mar 2012 06:19:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11073#t70711</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
