I am trying to create an Open Office Document with Hebrew characters within it.
I have a separate file defining the Hebrew characters, and the file to create the Open Office Document.
myHebrew.pl
use charnames ();
#URL: http://perldoc.perl.org/perluniintro.html
#URL: https://en.wikipedia.org/wiki/Unicode_and_HTML_for_the_Hebrew_al
+phabet
our $alef = charnames::string_vianame("HEBREW LETTER ALEF");
our $bet = charnames::string_vianame("HEBREW LETTER BET");
our $gimel = charnames::string_vianame("HEBREW LETTER GIMEL");
our $dalet = charnames::string_vianame("HEBREW LETTER DALET");
our $he = charnames::string_vianame("HEBREW LETTER HE");
our $vav = charnames::string_vianame("HEBREW LETTER VAV");
our $zayin = charnames::string_vianame("HEBREW LETTER ZAYIN");
our $het = charnames::string_vianame("HEBREW LETTER HET");
our $tet = charnames::string_vianame("HEBREW LETTER TET");
our $yod = charnames::string_vianame("HEBREW LETTER YOD");
our $final_kaf = charnames::string_vianame("HEBREW LETTER FINAL KAF");
our $kaf = charnames::string_vianame("HEBREW LETTER KAF");
our $lamed = charnames::string_vianame("HEBREW LETTER LAMED");
our $final_mem = charnames::string_vianame("HEBREW LETTER FINAL MEM");
our $mem = charnames::string_vianame("HEBREW LETTER MEM");
our $final_nun = charnames::string_vianame("HEBREW LETTER FINAL NUN");
our $nun = charnames::string_vianame("HEBREW LETTER NUN");
our $samekh = charnames::string_vianame("HEBREW LETTER SAMEKH");
our $ayin = charnames::string_vianame("HEBREW LETTER AYIN");
our $final_pe = charnames::string_vianame("HEBREW LETTER FINAL PE");
our $pe = charnames::string_vianame("HEBREW LETTER PE");
our $final_tsadi = charnames::string_vianame("HEBREW LETTER FINAL TSAD
+I");
our $tsadi = charnames::string_vianame("HEBREW LETTER TSADI");
our $qof = charnames::string_vianame("HEBREW LETTER QOF");
our $resh = charnames::string_vianame("HEBREW LETTER RESH");
our $shin = charnames::string_vianame("HEBREW LETTER SHIN");
our $tav = charnames::string_vianame("HEBREW LETTER TAV");
our $geresh = charnames::string_vianame("HEBREW PUNCTUATION GERESH");
our $gershayim = charnames::string_vianame("HEBREW PUNCTUATION GERSHAY
+IM");
1;
and "createOODoc.pl"
#!/usr/bin/perl -w
use strict;
use warnings;
require "myHebrew.pl";
our ($alef, $bet, $gimel, $dalet, $he, $vav, $zayin,
$het, $tet, $yod, $final_kaf, $kaf, $lamed, $final_mem, $mem,
$final_nun, $nun, $samekh, $ayin, $final_pe, $pe, $final_tsadi,
$tsadi, $qof, $resh, $shin, $tav, $geresh, $gershayim);
use OpenOffice::OODoc;
use utf8;
my $header = $bet . $samekh . $gershayim . $dalet;
my $doc = odfDocument(
file => "Parsha.odt",
create => 'text'
);
my $p = $doc->appendParagraph(
text => "",
style => "optionalParagraphStyle"
);
$doc->extendText($p, $header);
$p = $doc->appendParagraph(text => $header,
style => "optionalParagraphStyle"
);
$doc->save;
exit 0;
### End of File ###
When I run this, I get
Use of uninitialized value in lc at C:/Perl64/site/lib/OpenOffice/OODoc/File.pm line 378.
Cannot decode string with wide characters at C:/Perl64/lib/Encode.pm line 176.
What am I doing wrong? Can someone help me correct this?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.