<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=big5">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Sorry! My english is very poor!</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>How to handle chinese
mesage using Net::Jabber??</FONT></DIV>
<DIV><FONT size=2>I use the Exodus, Gush, Pandion, Psi, Trillian Pro client to
receive the message.But it have error in</FONT></DIV>
<DIV><FONT size=2>showing chinese message.</FONT></DIV>
<DIV><FONT size=2>use Encode --- Encode::from_to($subject, "big5", "utf-8" ) ---
</FONT><FONT size=2>can not make it correct.</FONT></DIV>
<DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>PS:</FONT></DIV>
<DIV><FONT size=2>Net::Jabber V2.0</FONT></DIV>
<DIV><FONT size=2>perl 5.8.7 ( ActivePerl Build 813)</FONT></DIV>
<DIV>WIN2K</DIV>
<DIV><FONT
size=2>===============================================================</FONT></DIV></DIV>
<DIV><FONT size=2>use strict;<BR>use Net::Jabber;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Declare our constants<BR># ---------------------<BR>use
constant RECIPIENT => <A
href="mailto:'luke@localhost'">'luke@localhost'</A>;
# Jabber ID to be notified<BR>use constant SERVER =>
'localhost'; # Jabber server to
connect to<BR>use constant PORT =>
5222; # Port to connect
to<BR>use constant USER =>
'luke'; # user this script connects as<BR>use
constant PASSWORD => <A
href="mailto:'luke!@#'">'luke!@#'</A>; # password
associated with USER<BR>use constant RESOURCE =>
'perlscript';</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Read and parse email and extract header info<BR>#
--------------------------------------------<BR></FONT><FONT size=2># Create a
new Jabber client and connect<BR># --------------------------------------<BR>my
$connection = Net::Jabber::Client->new();<BR>$connection->Connect(
"hostname" =>
SERVER,<BR>
"port" => PORT )<BR> or die "Cannot
connect ($!)\n";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Identify and authenticate with the server<BR>#
-----------------------------------------<BR>my @result =
$connection->AuthSend( "username" =>
USER,<BR>
"password" =>
PASSWORD,<BR>
"resource" => RESOURCE );<BR>if ($result[0] ne "ok") {<BR> die
"Ident/Auth with server failed: $result[0] - $result[1]\n";<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>open(HANDLE,"mailerd.log");<BR>while (<HANDLE>){<BR>if
($_=~/^\[(.*)\]\s+\[(.*)\]\s+(.*)<(.*)>\s+\->\s+<(.*)>\s+\((.*)/){<BR>#
Create a message and build it up<BR># --------------------------------<BR>my
$time=$1;<BR>my $from=$4;<BR>my $to=$5;<BR>my $subject=$6;<BR><FONT
color=#ff0000>use Encode;<BR>Encode::from_to($subject, "big5", "utf-8" )
;</FONT><BR> <BR>my $msg =
Net::Jabber::Message->new();<BR>$msg->SetMessage(
"to" =>
RECIPIENT,<BR>
"subject" => "Email from
$from",<BR>
"body" => join("\n", "Subject:
$subject",<BR>
"Date: $time") );<BR># Send the message<BR>#
----------------<BR>$connection->Send($msg);<BR> <BR>}<BR>}<BR>#
Disconnect from the Jabber server<BR>#
---------------------------------<BR>$connection->Disconnect();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>exit;<BR></FONT></DIV></FONT></DIV></BODY></HTML>