Reply to Re: quoted printable??

Your name:

Reply:


Posted by Sandman on 07/15/06 06:01

In article <1152926236.589373.301990@s13g2000cwa.googlegroups.com>,
"Chung Leong" <chernyshevsky@hotmail.com> wrote:

> Sandman wrote:
> > Maybe it's me who is misunderstanding this, but isn't this string in
> > quoted printable:
> >
> > "OLED & =?ISO-8859-1?Q?br=E4nsleceller?="
>
> I think the term is "quoted word." It's sort of confusing.
>
> > So, ok - it isn't quoted printable, or? I've always thought that the
> > Content-Type header only referred to the body of the text, the subject
> > line still had to be in quoted-printable, which is why swedish
> > characters in the post body isn't garbled like above. How do I parse
> > it back to what it's supposed to be:
> >
> > "OLED & bränsleceller"
>
> With regular expression, of course.
>
> function quoted_word_callback($m) {
> switch($m[2]) {
> case 'Q': case 'q': return quoted_printable_decode($m[3]);
> case 'B': case 'b': return base64_decode($m[3]);
> }
> }
>
> echo preg_replace_callback('/=\?(.*)\?([BQ])\?(.*)\?=/U',
> 'quoted_word_callback', $s);

It didn't work...

#!/usr/bin/php
<?
function quoted_word_callback($m) {
switch($m[2]) {
case 'Q': case 'q': return quoted_printable_decode($m[3]);
case 'B': case 'b': return base64_decode($m[3]);
}
}
$s = "OLED & =?ISO-8859-1?Q?br=E4nsleceller?=";
echo preg_replace_callback('/=\?(.*)\?([BQ])\?(.*)\?=/U',
'quoted_word_callback', $s);
?>

Result:

OLED & br”nsleceller

Instead of:

OLED & bränsleceller



--
Sandman[.net]

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация