Re: Q.: MARC8 vs. MARC/Unicode and pymarc and misencoded III records

From: Lemann, Alexander <ablemann_at_nyob>
Date: Mon, 12 Mar 2012 09:55:28 -0400
To: CODE4LIB_at_LISTSERV.ND.EDU
For more background, I found the text from this session at the most recent PyCon interesting.  It's a nice overview of Unicode in Python.
"Pragmatic Unicode or How Do I Stop the Pain?"  -- Ned Batchelder
http://nedbatchelder.com/text/unipain.html


> -----Original Message-----
> From: Code for Libraries [mailto:CODE4LIB_at_LISTSERV.ND.EDU] On Behalf Of
> Brian Kennison
> Sent: Friday, March 09, 2012 9:17 AM
> To: CODE4LIB_at_LISTSERV.ND.EDU
> Subject: Re: [CODE4LIB] Q.: MARC8 vs. MARC/Unicode and pymarc and
> misencoded III records
> 
> On Mar 8, 2012, at 1:46 PM, Terray, James wrote:
> 
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 9:
> ordinal not in range(128)
> 
> 
> Hello everyone,
> 
> I just ran into this the other day when trying to write to a file. I searched the
> documentation and found this:
> 
> fp = codecs.open("dc.csv", mode="w", encoding="utf-8")
> 
> This opens a file that is utf-8 aware and it let me write the file. Doesn't answer
> your question about the encoding but it will let you save the record.
> 
> --
> Brian Kennison
> Western Connecticut State University
Received on Mon Mar 12 2012 - 09:56:27 EDT