Dumb question about utf-8 handling

[email protected] (Gene Damon)
Newsgroups perl.perl4lib
Message-ID <[email protected]>
Been using marc.pm for some time to do a "bunch-o-stuff," but haven't 
had to deal with unicode problems until now.  Couple of basic questions.

1.  If I use the "$record->encoding()" call, is it  simply checking for 
the "a" in leader position 9?  That is,  it is not doing anything more 
complicated, like checking the actual data.

(Reason for the question, if leader position 9 is wrong, and encoding 
depends on it, then encoding will not tell me anything more than marc.pm 
thinks that it is unicode.)

2.  If I want to update a record that is unicode do I have to make sure 
any text string that I send in say, append_fields(... has been encoded 
as utf8, i.e., use some perl function to ensure that the string(s) are 
utf8?  Alternatively, does marc.pm handle that automatically when it 
thinks it has a utf8 record?

(This problem comes from working with a set of records.  When I update 
those that have leader byte 9 set to "a," and I try to do something with 
the updated record, e.g., read it,  I crash with the  "does not map to 
..." message.  That leads me to assume that either I need to do 
something with the stuff I am adding to make it utf8 or I have records 
that say they are utf8 and are not.  Running some of the records through 
a little check program I have, usually finds a problem with the record 
length when it hits these records that were changed.)

-- 
Gene Damon
Director of Library Automation &
Learning Resources
Virginia Community College System
(804) 819-4981 (voice)
(804) 819-4773 (fax)
[email protected]
Address:
James Monroe Bldg.
15th Floor
101 N. 14th St.
Richmond, VA 23219

http://library.vccs.edu/reference
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.