ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: How can I use xml file encode gb2312 with XML::Parser
by umesh other posts by this author
Dec 5 2001 5:55AM messages near this date
view in the new Beta List Site
How can I use xml file encode gb2312 with XML::Parser | =?gb2312?B?tPC4tDogSG93IGNhbiBJIHVzZSB4bWwgZmlsZSBlbmNvZGUgZ2IyMw==?= =?gb2312?B?MTIgd2l0aCBYTUw6OlBhcnNlcg==?=
How can I use xml file encode gb2312 with XML::ParserHi Guyii,

Pls. just use this and see if works or not. I have used it for Japanese.

 $p = new XML::Parser(Handlers =>  {Start => \&handle_start,
                                    End   =>  \&handle_end,
                                    Char  =>  \&handle_char},
               ParseParamEnt =>  1,
               NoLWP =>  1,
       );
 $p-> parsefile($sFileName,ProtocolEncoding => 'x-sjis-unicode');


Download Jcode from CPAN, may be Big5 will be useful for Chinese language.

After parsing the string use the following, in the handle_char

  $string=$p-> recognized_string();
  $string=jcode($string)-> sjis;


Pls. use this and reply me.

Regards

Umesh.

*****************************
Umesh A. Deshmukh.
Manas Solutions Pvt. Ltd.
umesh@[...].com
http://www.manas-solutions.com
Ph. : 91+020+4006358,4223991/92
*****************************
  ----- Original Message -----
  From: ¹Ëܲ
  To: Perl-XML@[...].com
  Sent: Monday, December 03, 2001 10:07 PM
  Subject: How can I use xml file encode gb2312 with XML::Parser




  HI,everybody:
       I need a help.
       Today my boss tell me to write a program which can read some xml
encoded by Chinese GB2312. I try to use XML::Parser to check it ,but I can't
find the file GB2312.enc at "XML/Parser/Encodings/".So the parser said
"can't find gb2312.enc at /.../.../XML/Parser/Encodings/". SoI try to use
the file GB2312.enc which at "/site/5.7.2/Encode/" but it seem can't
work.The Parser said "gb2312.enc is not a map file".And I find the file at
/XML/Parser/Encodings/ is a binary file,and the other is a text file.

       I find a lot of documents to explain how to encode XML .But I can't
do it well.So please help me.
       My question is: Can I use the file which at Encode's dir to replace
the file at XML/Parser/Encodins.If can't ,what can I do to parser the xml
encoded by GB2312.

       Thanks.And sorry for my pool English.
                            guyii
Attachments:
unknown1

Thread:
=?gb2312?B?ucvcsg==?=
umesh
=?gb2312?B?ucvcsg==?=

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved