Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14103

Re: Encoding Problems

From Tim Streater <timstreater@greenbee.net>
Newsgroups comp.lang.php
Subject Re: Encoding Problems
Date 2014-07-18 10:29 +0100
Message-ID <180720141029326419%timstreater@greenbee.net> (permalink)
References (1 earlier) <53B7520B.8080506@arnowelzel.de> <53B7529D.9050002@arnowelzel.de> <lpm64b$28i$2@dont-email.me> <53C0153B.9070807@arnowelzel.de> <lqao35$8v5$1@dont-email.me>

Show all headers | View raw


In article <lqao35$8v5$1@dont-email.me>, stef_204 <notvalid@nomail.nul>
wrote:

> Sorry to ask but I am struggling with the "subject" part of the email.
> 
> I tried to find a fix but not joy, yet.
> 
> I can decode the base64 encoded subject of each email individually by 
> adding a: mb_decode_mimeheader as follows, but that's really just a 
> "hack" and not proper, IMHO.
> 
> And that only decodes $subject on the html page produced for individual 
> emails, not the top level html page/rss feed which lists all of the 
> emails.
> 
> The subjects there are still reading:
> "=?UTF-8?B?"InsertGarbledText (base64) here"=?=

These are called "encoded words". You can read about it in RFC2047, or
look up the WikiPedia article on MIME (in caps). You'll have to write
some PHP to decode those. In general the format is:

introducer: =?
charset: UTF-8 (in this case)
separator: ?
coding: B for base64, Q for quoted printable
separator: ?
encoded text follows
terminator: ?=

That will allow you to pick the item apart and know what to do with it.

BTW, if you are doing stuff with emails, there's no substitute for
reading the RFCs and understanding how emails are put together. That's
what I did as part of the process for writing my own email client. RFCs
2045, 2046, 2047, 2048, and 2049 are a good place to start.

-- 
"People don't buy Microsoft for quality, they buy it for compatibility
with what Bob in accounting bought last year. Trace it back - they buy
Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-02 15:53 +0000
  Re: Encoding Problems Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-02 15:15 -0400
    Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-03 10:18 +0000
  Re: Encoding Problems Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-02 21:49 +0200
    Re: Encoding Problems bill <william@TechServSys.com> - 2014-07-03 08:09 -0400
  Re: Encoding Problems Christoph Michael Becker <cmbecker69@arcor.de> - 2014-07-02 22:25 +0200
    Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-03 10:16 +0000
  Re: Encoding Problems bill <william@TechServSys.com> - 2014-07-03 08:08 -0400
    Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-03 13:17 +0000
  Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-05 03:16 +0200
    Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-05 03:19 +0200
      Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-10 13:57 +0000
        Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-11 18:47 +0200
          Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-14 08:35 +0000
          Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-18 09:06 +0000
            Re: Encoding Problems Tim Streater <timstreater@greenbee.net> - 2014-07-18 10:29 +0100
              Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-18 09:38 +0000
                Re: Encoding Problems Tim Streater <timstreater@greenbee.net> - 2014-07-18 11:05 +0100
                Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-18 11:42 +0000
                Re: Encoding Problems Tim Streater <timstreater@greenbee.net> - 2014-07-18 14:32 +0100
            Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-19 09:36 +0200
              Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-29 13:58 +0000
    Re: Encoding Problems Christoph Michael Becker <cmbecker69@arcor.de> - 2014-07-05 03:28 +0200
      Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-06 01:36 +0200
        Re: Encoding Problems Denis McMahon <denismfmcmahon@gmail.com> - 2014-07-06 02:16 +0000
          Re: Encoding Problems Richard Damon <Richard@Damon-Family.org> - 2014-07-05 23:19 -0400
            Re: Encoding Problems gordonb.defz8@burditt.org (Gordon Burditt) - 2014-07-06 00:21 -0500
              Re: Encoding Problems Richard Damon <Richard@Damon-Family.org> - 2014-07-06 07:14 -0400
                Re: Encoding Problems Denis McMahon <denismfmcmahon@gmail.com> - 2014-07-07 01:24 +0000
        Re: Encoding Problems Christoph Michael Becker <cmbecker69@arcor.de> - 2014-07-06 15:30 +0200
          Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-06 21:46 +0200
            Re: Encoding Problems Richard Damon <Richard@Damon-Family.org> - 2014-07-06 16:21 -0400
              Re: Encoding Problems Arno Welzel <usenet@arnowelzel.de> - 2014-07-07 03:49 +0200
    Re: Encoding Problems stef_204 <notvalid@nomail.nul> - 2014-07-10 13:18 +0000

csiph-web