|
|
sybperl-l Archive
Up Prev Next
From: "Daniel Wang, LIB" <danwang at walib dot tstc dot edu>
Subject: Re: A bug in function ORD(), or what?
Date: Sep 15 1997 7:07PM
Michael,
First of all, I want to tell you how lucky I am to have your
Sybperl and how grateful I am to your help in using it. I did as you
suggested and bypassed the character set problem, though it took
me quite a while to build that hash table :)) Now
I am able to pull out accurate bibliographic information from my
online catalog and put it on the web.
BTW, do you know how to display diacritics on the web? Some of the
titles I retrieved onto the web from my Sybase catalog are in
foreign languages. But these titles with diacritics don't show up
right in a browser. For exampe, if there is a character which is a
caret on top of an "a", it will only display a stranger character in
front of the "a", though my reconst function pulls out the right
reconst info.
Is it something to do with PC/windows incapability
to display these non-printable characters? Windows doesn't even
display most character whose values are beyond 127.
Thank you so much!
I'd like to share with you my URL once I get this web access to
my sybase based library online catalog operational. You should enjoy
the fruit of your hardwork and helpfullness.
>
>
> >
> > 1st char "Å" is the ASCII char whose ASCII value 143 specifies the
>
> Here's your problem. The ord() value of a character depends on the
> character set. On most PCs, Å is 143.
>
> However, most Unix systems use ISO-8859-1 (also known as Latin-1)
> where Å is character number 197.
>
> So what you need is to rewrite ord() to map the values of the extended
> character set that you used to build the reconst field to the
> appropriate numeric values. The easiest way to do that is to
> build a hash table where the key is the character and the value
> the number you want:
>
> %charMap = ('Å' => 143,
> 'Î' => 140,
> etc...);
>
> For the low bit characters the ord() function will work fine.
>
> So now your special ord() function will look something like
>
> sub my_ord {
> my $char = shift;
>
> my $ret = ord($char);
> if($ret < 128) {
> $ret;
> } else {
> $charMap{$char};
> }
> }
>
> Hope this helps...
>
> Michael
> --
> Michael Peppler -||- Data Migrations Inc.
> mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
>
Daniel Wang
Systems Administrator/Librarian
Texas State Tech. College
Waco, TX 76705
Office: (817)867-2343
FAX: (817)867-2339 or 2340
Email: danwang@tstc.edu
Web: http://www.library.tstc.edu
|