/[suikacvs]/messaging/newsportal/newsportal.php
Suika

Diff of /messaging/newsportal/newsportal.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by wakaba, Sat Dec 1 15:15:08 2001 UTC revision 1.25 by wakaba, Sat Dec 1 15:32:13 2001 UTC
# Line 448  function headerDecode($value) { Line 448  function headerDecode($value) {
448        $newvalue=headerDecode($newvalue);  // maybe there are more encoded        $newvalue=headerDecode($newvalue);  // maybe there are more encoded
449      return(mb_convert_encoding($newvalue, "EUC-JP", "auto"));      // parts      return(mb_convert_encoding($newvalue, "EUC-JP", "auto"));      // parts
450    } else {    } else {
451      if (eregi('".*"',$value)) {  // quoted-pair      return(mb_convert_encoding(decode_structured_body($value), "EUC-JP", "auto"));
       ereg('([^"]*)"(([^"]+|\\\\.)*)"(.*)',$value,$vals);  
       $newvalue = $vals[1].decode_quoted_pair($vals[2]).$vals[4];  
       return(mb_convert_encoding($newvalue, "EUC-JP", "auto"));  
     } else {   // there wasn't anything encoded, return the original string  
       return(mb_convert_encoding($value, "EUC-JP", "auto"));  
     }  
452    }    }
453  }  }
454    
# Line 572  function parse_header($hdr,$number="") { Line 566  function parse_header($hdr,$number="") {
566  }  }
567    
568  function decode_structured_body ($body) {  function decode_structured_body ($body) {
569    $patterns = array ("/\"((?:[^\"\\\\]+|\\\\.)*)\"/e");    $patterns = array (
570    $replace = array ("mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')");        "/\"((?:[^\"\\\\]+|\\\\.)*)\"/e",
571          "/\(((?:[^)\\\\]+|\\\\.)*)\)/e",
572      );
573      $replace = array (
574          "mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')",
575          "'('.mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto').')'",
576      );
577    return preg_replace ($patterns, $replace, $body);    return preg_replace ($patterns, $replace, $body);
578  }  }
579    
# Line 699  function parse_message($rawmessage) { Line 699  function parse_message($rawmessage) {
699  //      if ($body=="") $body=" ";  //      if ($body=="") $body=" ";
700  //    }  //    }
701      $body=decode_body($body,$message->header->content_transfer_encoding);      $body=decode_body($body,$message->header->content_transfer_encoding);
702      $message->body[0]=$body;      $message->body[0] = mb_convert_encoding($body, "EUC-JP", "auto");
703    }    }
704      if (!isset($message->header->content_type_charset))      if (!isset($message->header->content_type_charset))
705        $message->header->content_type_charset=array("ISO-8859-1");        $message->header->content_type_charset=array("ISO-8859-1");

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24