Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; "subject:')": 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'assume': 0.14; "'r',": 0.16; 'csv': 0.16; 'module?': 0.16; 'received:209.85.216.53': 0.16; 'subject:ignore': 0.16; 'symbols': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'so.': 0.16; 'work,': 0.20; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'subject: .': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'open': 0.33; 'reader': 0.33; 'subject:with': 0.35; 'received:209.85': 0.35; 'received:google.com': 0.35; 'received:209.85.216': 0.37; 'received:209': 0.37; 'skip:p 20': 0.39 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=ok9Bv5rKiNRCElC3ynw2Pto8nY0WfFKC0FlKfBg3hEs=; b=hBPhXVvB5Cg+y+QUgfgY3C58ARHukvVsW4gwxZwmukR1Y3UXybPr3XR4Xh2n+9cI6/ tYshc8KkkqHPKd5iD8vMLrmewMVsK4AiKftZbUPgeaMXnXYftQccOYgC1LezwpW+9/xS InioOhGN9g3k5d+RFY2E3wsm6n396qWe71sSAh3Srf5Gx1591dt+82X8FMfE6TMJyAxa 7Rwp/ATA/i5GdnFFRVd01+jbyCH8xAyEbXWEY8/55Ci9j2CmN6wguyvW7bYob0+tGtb/ CTAdOlEExGl4FTotAK3udBSqwnJtome5u4xD500zF6QQqLWRIksjH83JEc2NGcGJZ6sn qXYQ== X-Gm-Message-State: ALoCoQkkh0AQnHZLEBFvm296J4hsnNcpuyaYNBDn8rWfdfLoDiWfeNl3W8ADc+mUM4XPBQVvSvJ9 X-Received: by 10.60.45.244 with SMTP id q20mr8969257oem.35.1429018693913; Tue, 14 Apr 2015 06:38:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <552d14c0$0$12991$c3e8da3$5496439d@news.astraweb.com> References: <552d14c0$0$12991$c3e8da3$5496439d@news.astraweb.com> From: Vincent Davis Date: Tue, 14 Apr 2015 07:37:53 -0600 Subject: Re: using DictReader() with .decode('utf-8', 'ignore') To: "Steven D'Aprano" Cc: "python-list@python.org" Content-Type: multipart/alternative; boundary=001a11c220d6a0e56a0513af57bd X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1429018696 news.xs4all.nl 2921 [2001:888:2000:d::a6]:45015 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88956 --001a11c220d6a0e56a0513af57bd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > Which DictReader? Do you mean the one in the csv module? I will assume so= . > =E2=80=8Byes.=E2=80=8B > > # untested > with open(dfile, 'r', encoding=3D'utf-8', errors=3D'ignore', newline=3D''= ) as f: > reader =3D csv.DictReader(f) > for row in reader: > print(row['fieldname']) > What you have seems to work, now I need to go find my strange symbols that are not =E2=80=8B'utf-8' and see what happens I was thought, that I had to open with 'rb' to use =E2=80=8Bencoding? Vincent Davis --001a11c220d6a0e56a0513af57bd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

=
Whic= h DictReader? Do you mean the one in the csv module? I will assume so.
<= /div>
=E2=80=8Byes.=E2=80=8B=C2=A0

# untested
with open(dfile, 'r', encoding=3D'utf-8', errors=3D'ign= ore', newline=3D'') as f:
=C2=A0 =C2=A0 reader =3D csv.DictReader(f)
=C2=A0 =C2=A0 for row in reader:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print(row['fieldname'])

What you have seem= s to work, now I need to go find my strange symbols that are not =E2=80=8B<= span style=3D"font-family:arial,sans-serif">'utf-8' and see what ha= ppens
I was thought, that I had to open with 'rb= ' to use =E2=80=8Bencoding= ?


Vincent Davis

--001a11c220d6a0e56a0513af57bd--