For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > July 2004 > Bizarre PerlScript/WSH/UTF-8 problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bizarre PerlScript/WSH/UTF-8 problem

2004-07-23, 8:56 pm

Hi All,

I try to put utf8 material into a browser page via a Perl script
embedded in an HTML page. The whole thing runs under Windows XP
Professional, I am using ActivePerl 5.8.0 and IE 6.0. A minimal
file exhibiting the problem is given here:

<HTML>
<HEAD>
<TITLE>PerlScript Minimal Test</TITLE>
</HEAD>
<BODY>
<H2>A Chinese Character: 一</H2><!-- test, works well -->
<SCRIPT LANGUAGE="PerlScript">
use utf8; # Doesn't seem to make any difference here
#
$abwwide="\x{0410}\x{0411}\x{0412}" # Cyrillic ABW
$window->document->write($abwwide); # Doesn't work
#
$abw ="АБВ" # Again Cyrillic ABW, but in utf8
$window->document->write($abw); # Doesn't work
#
# Direct approach
$window->document->write("АБВ"); # doesn't work, either
#
$htmlified_char='АБВ'; The same, ABW
$window->document->write($htmlified_char); # works!
</SCRIPT>
</BODY>
</HTML>

I think I've browsed the complete documentation of AS Perl as far
as it is at least remotely related to either Unicode or WSH; I've
been writing Perl code for Linux which successfully digests thousands
of lines of utf8-encoded text in the wildest array of languages
(e.g., Mongolian, Arabic, Chinese, Tibetan all in one document)
and it works. However I fail to understand where to search for a
solution to the above-mentioned problem.

Thanks for any hints,

Oliver.


--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de

2004-07-23, 8:56 pm

corff@cis.fu-berlin.de wrote:
: Hi All,

: I try to put utf8 material into a browser page via a Perl script
: embedded in an HTML page. The whole thing runs under Windows XP
: Professional, I am using ActivePerl 5.8.0 and IE 6.0. A minimal
: file exhibiting the problem is given here:


Of course I tried various settings of "View -> Encoding", and I tried
to set these as <META ...> statements, but this did not remove any
obstacle.


Oliver.

--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de

2004-07-30, 8:56 pm

corff@cis.fu-berlin.de wrote:

With regard to the code below, I plead guilty for writing: "Doesn't work".
What I wanted to say instead is that the browser displays weird garbage
or question marks but not the desired output.

: Hi All,

: I try to put utf8 material into a browser page via a Perl script
: embedded in an HTML page. The whole thing runs under Windows XP
: Professional, I am using ActivePerl 5.8.0 and IE 6.0. A minimal
: file exhibiting the problem is given here:

: <HTML>
: <HEAD>
: <TITLE>PerlScript Minimal Test</TITLE>
: </HEAD>
: <BODY>
: <H2>A Chinese Character: 一</H2><!-- test, works well -->
: <SCRIPT LANGUAGE="PerlScript">
: use utf8; # Doesn't seem to make any difference here
: #
: $abwwide="\x{0410}\x{0411}\x{0412}" # Cyrillic ABW
: $window->document->write($abwwide); # Doesn't work
: #
: $abw ="???" # Again Cyrillic ABW, but in utf8
: $window->document->write($abw); # Doesn't work
: #
: # Direct approach
: $window->document->write("???"); # doesn't work, either
: #
: $htmlified_char='АБВ'; The same, ABW
: $window->document->write($htmlified_char); # works!
: </SCRIPT>
: </BODY>
: </HTML>

If anybody feels that this is not a perl-related question which is better
dealt with in a different newsgroup, I'll be happy to receive and follow
suggestions where to look/write.

Thanks,

Oliver.

--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com