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


Groups > comp.lang.python > #58538

Re: how to find out utf or not

From "Gisle Vanem" <gvanem@yahoo.no>
References <mailman.2054.1383661067.18130.python-list@python.org> <52791f58$0$29972$c3e8da3$5496439d@news.astraweb.com>
Subject Re: how to find out utf or not
Date 2013-11-05 18:10 +0100
Newsgroups comp.lang.python
Message-ID <mailman.2068.1383695345.18130.python-list@python.org> (permalink)

Show all headers | View raw


"Steven D'Aprano" <steve+comp.lang.python@pearwood.info> 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

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


Thread

how to find out utf or not Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-11-05 16:32 +0330
  Re: how to find out utf or not Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-05 16:39 +0000
    Re: how to find out utf or not "Gisle Vanem" <gvanem@yahoo.no> - 2013-11-05 18:10 +0100

csiph-web