First, when an XPS file is being processed, you need to realize that
there are two distinct document fragments:
a) the part which you are printing out via $t->{ XXXX }
b) the rest of the document, which is printed straight out of the
XML::XPath::* objects ( I think that's what it is, instead of
XML::LibXML objects, but it doesn't matter which in this context... )
So part b), which is the portion that you are not handling, is being
stored as UTF-8. However, I suspect that the charset you're using to set
the contents of $t in the XPS file is Shift_JIS. That's bad, because
that means you're mixing UTF-8 characters and Shift_JIS characters.
For dynamically generated strings, you would need to convert them within
the perl code in the XPS file. Otherwise, you would need to convert the
entire document to UTF-8 format. You could use the iconv utility to do this.
--d
Tomoko OHOYA wrote:
> Hi,
>
> I have installed AxKit1.6 on Red Hat Linux7.3(Apache/1.3.23 mod_perl/1.26) with
> XML-LibXML-1.52
> XML-XPath-1.12
> Unicode-Map-0.112
> Unicode-Map8-0.11
> Unicode-MapUTF8-1.08
> Unicode-String-2.06
>
> I can use Japanese character(UTF-8N or Shift_JIS) in both XML files and XPS files,
>but when I use Japanese
> character in XPS file, [Character not from source char set] error occur.
>
>
> error_log(UTF-8N without XPathScriptCharset)
>-----------------------------------------------
> [Fri Jun 21 18:21:07 2002] [warn] Apache does not support line-end comments.
>Consider using quotes around
> argument: "#default"
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] fast handler called
>for /test.xml
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Content Provider
>Override:
> Apache::AxKit::Provider::File
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [req] File Provider
>given $r:
> /home/docs/test.xml
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] checking if we
>process this resource
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] media: screen,
>preferred style: #default
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Cache: key =
>788247a77d398fc9c2853cf06092ede9
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] getting styles and
>external entities from the
> XML
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] styles cached
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] cache doesn't exist
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] some condition
>failed. recreating output
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] styles:
>Apache::AxKit::Language::XPathScript
> (/main_test.xps)
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Style Provider
>Override:
> Apache::AxKit::Provider::File
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider
>looking up uri
> /main_test.xps
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider
>set filename to
> /home/docs/main_test.xps
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] about to execute:
> Apache::AxKit::Language::XPathScript::handler
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] XPathScript: Getting
>XML Source
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] XPathScript:
>reparsing file
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Provider
>get_ext_ent_handler for /dtds/main.dtd
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Content Provider
>Override:
> Apache::AxKit::Provider::File
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [req] File Provider
>given $r:
> /home/docs/dtds/main.dtd
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] XPathScript:
>Returning parsed source tree
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Checking stylesheet
>mtime: 1024651224
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Recompiling
>stylesheet:
> /home/docs/main_test.xps
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] XPathScript:
>extracting from
> '/home/docs/main_test.xps' contents: <%
> my $this_page = $r->uri;
> my $email = findvalue('/webpage/head/email/text()');
> %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title><%= findvalue('/webpage/head/title/text()') %></title>
> </head>
> <body bgcolor="#FFFFFF" link="#003399" vlink="#555555">
> Main Test 闃ア
> <h1><%= findvalue('/webpage/head/title/text()') %></h1>
>
> <%= findvalue('/webpage/body/text()') %>
>
> </body>
> </html>
>
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Compiling script:
> package Apache::AxKit::Language::XPathScript::ROOT::home::docs::main_test_2exps; use
>Apache qw(exit);use
> XML::XPath::Node;Apache::AxKit::Language::XPathScript::Toys->import;sub handler {my
>($r, $xp, $t) = @_;
> #line 1 /home/docs/main_test.xps
> print q||;
> #line 1 /home/docs/main_test.xps
>
> my $this_page = $r->uri;
> my $email = findvalue('/webpage/head/email/text()');
> print q|
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>|;
> #line 8 /home/docs/main_test.xps
> print(do { findvalue('/webpage/head/title/text()') });
> print q|</title>
> </head>
> <body bgcolor="#FFFFFF" link="#003399" vlink="#555555">
> Main Test 闃ア
> <h1>|;
> #line 12 /home/docs/main_test.xps
> print(do { findvalue('/webpage/head/title/text()') });
> print q|</h1>
>
> |;
> #line 14 /home/docs/main_test.xps
> print(do { findvalue('/webpage/body/text()') });
> print q|
>
> </body>
> </html>
> |;;
> return Apache::Constants::OK;
> }
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Running XPathScript
>script
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] execution of:
> Apache::AxKit::Language::XPathScript::handler finished
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] writing xml string
>to browser
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Caught an exception
> [Fri Jun 21 18:21:07 2002] [error] [client 192.168.1.41] [AxKit] [Error] Character
>not from source char set: フオ
>
>ク〓゛、ソ、マノヤエーチエ、ハ・゛・・チ・ミ・、・ネ、゛、ソ、マ・・、・ノハクサ〓ヌ、ケ
> at /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 93.
>
> [Fri Jun 21 18:21:07 2002] [error] [client 192.168.1.41] [AxKit] From:
>/usr/lib/perl5/site_perl/5.6.1/i386-
> linux/Apache/AxKit/Exception.pm : 9
> [Fri Jun 21 18:21:07 2002] [error] [client 192.168.1.41] [AxKit] [Backtrace]
>Character not from source char
> set:
>テ個オツクテコツ、テ楪、ツソツ、テ湘嘉板エツーテ・エツ、テ環・テ楪・テォツ・テ・・テ青・ツ、ツ・テ按、テ楪、ツソツ、テ渉・テッツ・ツ、ツ・テ嘉環クツサテコツ、テ・、ツケ
> at
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 93.
> Apache::AxKit::Exception::new('Apache::AxKit::Exception::Error', '-text',
>'Character not from source
> char set:
>M-LM-5M-8M-zM-$M-^M-$M-?M-$M-OM-IM-TM-4M-0M-AM-4M-$M-JM-%M-^M-%M-kM-%M-AM-%M-PM-%M-$...')
> called at
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 839
> AxKit::prep_exception('Character not from source char set:
>M-LM-5M-8M-zM-$M-^M-$M-?M-$M-OM-IM-TM-4M-0M-
> AM-4M-$M-JM-%M-^M-%M-kM-%M-AM-%M-PM-%M-$...') called at
>/usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line
> 141
> AxKit::__ANON__('Character not from source char set:
>M-LM-5M-8M-zM-$M-^M-$M-?M-$M-OM-IM-TM-4M-0M-AM-4M-
> $M-JM-%M-^M-%M-kM-%M-AM-%M-PM-%M-$...') called at
>/usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 93
> AxKit::__ANON__('^J<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
>Transitional//EN">...') called at
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 803
> AxKit::deliver_to_browser('Apache=SCALAR(0x8569fec)', 0) called at
>/usr/lib/perl5/site_perl/5.6.1/i386-
> linux/AxKit.pm line 272
> eval {...} called at /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line
>255
> AxKit::main_handler('Apache=SCALAR(0x8569fec)',
>'Apache::AxKit::Provider::File=HASH(0x852d34c)') called
> at /usr/lib/perl5/site_perl/5.6.1/i386-linux/AxKit.pm line 172
> AxKit::fast_handler('Apache=SCALAR(0x8569fec)') called at /dev/null line 0
> eval {...} called at /dev/null line 0
>
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Cache: key =
>fb0e18aae60dcaf11e413252d8a0e3da
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] styles:
>Apache::AxKit::Language::LibXSLT
> (/axkit/stylesheets/error.xsl)
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] Style Provider
>Override:
> Apache::AxKit::Provider::File
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider
>looking up uri
> /axkit/stylesheets/error.xsl
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider
>set filename to
> /home/axkit/demo/stylesheets/error.xsl
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] about to execute:
> Apache::AxKit::Language::LibXSLT::handler
> [Fri Jun 21 18:21:07 2002] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] getting
>the XML
> [Fri Jun 21 18:21:07 2002] [error] [client 192.168.1.41] [AxKit] [FATAL] Error
>occured while processing Error
> XML: Entity: line 1: error: Input is not proper UTF-8, indicate encoding !
> rror><file>/home/docs/test.xml</file><msg>Character not from source char set:
>フ
> ^
> Entity: line 1: error: Bytes: 0xB8 0xFA 0xA4 0xDE
> rror><file>/home/docs/test.xml</file><msg>Character not from source char set:
>フ
> ^
>
> // Tomoko OHOYA
> // [EMAIL PROTECTED]
> // http://www.kcn.ne.jp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]