Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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: UNSURE 0.205 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.69; '*S*': 0.10; 'subject:not': 0.03; 'encoding': 0.05; 'otherwise)': 0.09; 'unicode)': 0.16; 'wrote:': 0.18; 'string,': 0.24; 'unicode': 0.24; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.24; 'file.': 0.24; 'strongly': 0.30; 'assert': 0.31; 'summary': 0.32; 'to:name:python-list': 0.33; 'thank': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:212.82': 0.60; "you're": 0.61; 'you.': 0.62; 'received:77.238.189': 0.65; 'received:bullet.mail.ird.yahoo.com': 0.65; 'received:46': 0.66; 'from:addr:yahoo.no': 0.84; 'received:212.82.109': 0.84; 'subject:find': 0.84; 'old,': 0.85; 'system:': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.no; s=s1024; t=1383671421; bh=xR41oBOPp8kPLaMMupX1XzI61H3iwA+FY67NhbxUF5M=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:From:To:References:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE; b=AmssmuLhWWnKfoHWTVkF/WUj5Ct6e5OSkTOCMy77klJYmswWCjV+7oHIdtfJaXPu1i48pSB0DtkjGWA72Gk4GZDMPQneMnDI0qGx+3TsAAJuxPTTLB1lk6C8WLBoBFRljrUZZ4c/BVehYhBNEQK0zRchZoCJIPMUJHsuWl7qPBQ= X-Yahoo-Newman-Id: 495572.79996.bm@smtp144.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dXBCupQVM1nV870n_Gt5cm9cfmA4jcVNdoYviHbtmDl34Su qttzpt0JGNGiAeFMIiNmBWBH0_mlxz2Arv2cXdRQ6RnHQqUPJQ9CXIz_n3DQ UR8_41ZCksHk73eqF8jHWOEvT06kg0YBnhDrRdmlR9ApNk0kS8Y92XjP7UJB EtXlgpdX5_2Bws5Cmx2iNcaBA_agYTF2Pd2ciN31d2PS141tF5hfO2SoVmaq R8SM8dCryXhPzooLVE0HAvwoN3l5HRBmHnXCHuRo4rZuSg8OjcdDZJ68Eh0q fiuOLMPlmSBvGf_qFlLR.eCjn5AgakK7IxU0PCTtrkMY0E.Xbnz2iKYYmLXd pqDjBWOQ0sF.d4E6U6HO7bSTp3mQFtHzDViPLR8owcKwWoMantnU9ERqhqRB 34b6VoyVH78cq2xbBMaxHFW4GBAJcHn3M5YVgvHWZGuWQ7AtFHadjA86KVwp YTJJFBiH5nzKraqPKthBmz4ESPrwoV9rUIjCh2ZvJabDyjhzcfroTGjGCSQ3 7.L5n76N4gM1eYy0- X-Yahoo-SMTP: 8zhYLGyswBB3AGU8c4pvFIFOfA-- X-Rocket-Received: from SNURRE (gvanem@108.171.112.139 with ) by smtp144.mail.ir2.yahoo.com with SMTP; 05 Nov 2013 17:10:21 +0000 UTC From: "Gisle Vanem" To: "Python-list" References: <52791f58$0$29972$c3e8da3$5496439d@news.astraweb.com> Subject: Re: how to find out utf or not Date: Tue, 5 Nov 2013 18:10:16 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Mailman-Approved-At: Wed, 06 Nov 2013 00:49:05 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383695345 news.xs4all.nl 15875 [2001:888:2000:d::a6]:54991 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58538 "Steven D'Aprano" wrote: > If myVar is a Unicode string, you don't need to care about the encoding > (UTF-8 or otherwise) until you're ready to write it to a file. Then I > strongly recommend you always use UTF-8, unless you have to interoperate > with some old, legacy system: > > assert isinstance(myVar, unicode) > byte_string = myVar.encode('utf-8') An excellent summary of the mystics around text-encoding. Thank you. --gv