Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58505
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Neil Cerutti <neilc@norwich.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: how to find out utf or not |
| Date | 5 Nov 2013 15:30:19 GMT |
| Organization | Norwich University |
| Lines | 23 |
| Message-ID | <bdsh8bFcov1U1@mid.individual.net> (permalink) |
| References | <1383656577.1350.6.camel@debian> <1383656577.1350.6.camel@debian> <mailman.2055.1383662485.18130.python-list@python.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net J+xalMftmNmtt0TvXxsDzAbVXPMcNEGx17Y+wmZ7q425W2eB5I |
| Cancel-Lock | sha1:fD/oPbsQmA/hG9RNHxS2/BdFv30= |
| User-Agent | slrn/0.9.9p1/mm/ao (Win32) |
| Xref | csiph.com comp.lang.python:58505 |
Show key headers only | View raw
On 2013-11-05, Dave Angel <davea@davea.name> wrote: > On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh ><mohsen@pahlevanzadeh.org> wrote: >> Suppose i have a variable such as : myVar = 'x' > >> May be it initialized with myVar = u'x' or myVar = 'x' > >> So i need determine content of myVar that it's utf-8 or not, how > can i >> do it? > > Use the type() function and compare to unicode or str > respectively. E.g. If type(myvar)==unicode: That will tell you wether it's a unicode string or a byte string, but not the encoding of the source bytes. Unless there's some context I'm not privy to. u'x' is (hopefully) decoded already, but the encoding of 'x' is unknown. -- Neil Cerutti
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: how to find out utf or not Dave Angel <davea@davea.name> - 2013-11-05 08:41 -0600
Re: how to find out utf or not Neil Cerutti <neilc@norwich.edu> - 2013-11-05 15:30 +0000
Re: how to find out utf or not Dave Angel <davea@davea.name> - 2013-11-06 00:03 -0600
csiph-web