Hi,

I am trying to get e-mail piping working with Japanese.  I have tried the
following code, and it works for the body, but not the headers.  Is there
additional code I need to add to make the subject and from headers be
converted from JIS to EUC-JP?

$debuginfo .= "internal_encoding = ".mb_internal_encoding()."\n";
$ticketcore = new TicketCore;
$dbCore = new dbCore;
$registry = new Registry;
$template = new Smarty;
$templatedata = new TemplateData;
$settings = new Settings;
$mail = new htmlMimeMail();
//====================
// Update charset information
//====================
$mail->build_params['html_encoding'] = $html_encoding;
$mail->build_params['text_encoding'] = $text_encoding;
$mail->build_params['html_charset'] ?= $html_charset;
$mail->build_params['text_charset'] ?= $text_charset;
$mail->build_params['head_charset'] ?= $head_charset;
//====================

if ($licverify !=
md5(stripslashes(serialize($_LICENSE))."8723bds(SA^*(&[EMAIL PROTECTED]")) {
echo "<font face='Verdana' size='2' color='red'>ERROR: Variable Hash
Changed, Core Error</font>";
@mysql_close($dbCore->Link_ID);
exit;
end;
}
$debuginfo .= "Starting pipe fetching routines\n";
$fp = @fopen("php://stdin", "r");
if ($fp > 0) {
      while(!feof($fp)) {
         $line=fgets($fp, 120);
          $data .= $line;
    if (!isset($body)) {
       $headersmm .= $line;
                   if(ereg("^From:(.+)",$line)) {
                        $line=ereg_replace("From:","",$line);
                        $line=trim($line);
                        $line=ereg_replace ("\\\n","",$line);
                        $line=addslashes($line);
                        $sender=$line;
                    }

    if(ereg("^Subject:(.+)",$line)) {
                        $line=ereg_replace("Subject:","",$line);
                        $line=trim($line);
                        $line=ereg_replace ("\\\n","",$line);
                        $line=addslashes($line);
                        $subject=$line;
               }
           if(ereg("^\\\n",$line)) {
                        $body="";
                }
              }
             else {
                   $line=addslashes($line);
                   $body.=$line;
              }
        }
fclose($fp);
}

$debuginfo .= "Data fetched\n";

$debuginfo .= $headersmm.$body;
$headersmm = mb_decode_mimeheader($headersmm);
$body = mb_convert_encoding($body, "EUC-JP", "JIS");
$data = mb_convert_encoding($data, "EUC-JP", "JIS");


$headers = explode("\n",$headersmm);
$mess = explode("\n",$body);
$type = "pipe";
$debuginfo .= "\nStarting processing jobs\n";


$ticketcore->processBody($headers, $mess, "pipe","pipe", $headersmm,
$body, $data);

-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to