Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #112349

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding

From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: Capturing the bad codes that raise UnicodeError exceptions during decoding
Date 2016-08-04 15:45 -0400
Message-ID <mailman.177.1470339927.6033.python-list@python.org> (permalink)
References <1470336426.893449.686225577.24458777@webmail.messagingengine.com> <CAPTjJmp-RCZB2J+GVdVNVM56Nhe-4y9GL9MWW+L-RnpNGziFfw@mail.gmail.com> <1470338568.900965.686261921.548DDA14@webmail.messagingengine.com> <1470339924.3065250.686286553.51C83AD9@webmail.messagingengine.com>

Show all headers | View raw


On Thu, Aug 4, 2016, at 15:22, Malcolm Greene wrote:
> Hi Chris,
> 
> Thanks for your suggestions. I would like to capture the specific bad
> codes *before* they get replaced. So if a line of text has 10 bad codes
> (each one raising UnicodeError), I would like to track each exception's
> bad code but still return a valid decode line when finished. 

Look into writing your own error handler - there's enough information
provided to do this.

https://docs.python.org/3/library/codecs.html

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding Random832 <random832@fastmail.com> - 2016-08-04 15:45 -0400

csiph-web