Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85399
| References | <mailman.18555.1423453501.18130.python-list@python.org> <54d83ced$0$12895$c3e8da3$5496439d@news.astraweb.com> <CANc-5UxTFr-jUbDxEpWyBUFF1sznRPJ2ji6aGicCaru9V5rc_Q@mail.gmail.com> |
|---|---|
| From | Zachary Ware <zachary.ware+pylist@gmail.com> |
| Date | 2015-02-09 14:05 -0600 |
| Subject | Re: Python 3.x stuffing utf-8 into SQLite db |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18575.1423512371.18130.python-list@python.org> (permalink) |
On Mon, Feb 9, 2015 at 11:32 AM, Skip Montanaro
<skip.montanaro@gmail.com> wrote:
> LibreOffice spit out a CSV file
> (with those three odd bytes). My script sucked in the CSV file and
> inserted data into my SQLite db.
If all else fails, you can try ftfy to fix things:
http://ftfy.readthedocs.org/en/latest/
>>> import ftfy
>>> ftfy.fix_text('Anderson Barracuda Masters - 2010 St.
Patrick’s Day Swim Meet')
"Anderson Barracuda Masters - 2010 St. Patrick's Day Swim Meet"
It also seems to agree that there was a bad (en|de)coding with cp1252
at some point.
>>> ftfy.fixes.fix_encoding_and_explain('Anderson Barracuda Masters
- 2010 St. Patrick’s Day Swim Meet')
('Anderson Barracuda Masters - 2010 St. Patrick’s Day Swim Meet',
[('encode', 'sloppy-windows-1252'), ('decode', 'utf-8')])
--
Zach
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python 3.x stuffing utf-8 into SQLite db Skip Montanaro <skip.montanaro@gmail.com> - 2015-02-08 21:44 -0600
Re: Python 3.x stuffing utf-8 into SQLite db Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-09 15:51 +1100
Re: Python 3.x stuffing utf-8 into SQLite db Skip Montanaro <skip.montanaro@gmail.com> - 2015-02-09 11:32 -0600
Re: Python 3.x stuffing utf-8 into SQLite db Chris Angelico <rosuav@gmail.com> - 2015-02-10 04:41 +1100
Re: Python 3.x stuffing utf-8 into SQLite db Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-02-09 14:05 -0600
Re: Python 3.x stuffing utf-8 into SQLite db Skip Montanaro <skip.montanaro@gmail.com> - 2015-02-09 18:36 -0600
Re: Python 3.x stuffing utf-8 into SQLite db wxjmfauth@gmail.com - 2015-02-10 00:23 -0800
Re: Python 3.x stuffing utf-8 into SQLite db mm0fmf <none@mailinator.com> - 2015-02-09 19:41 +0000
csiph-web