Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On 5 Nov 2013 15:30:19 GMT, Neil Cerutti wrote: On 2013-11-05, Dave Angel wrote: > On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh >> May be it initialized with myVar = u'x' or myVar = 'x' My solution assumed he wanted to distinguish between those two cases. >> So i need determine

Re: how to find out utf or not

2013-11-05 Thread Gisle Vanem
"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(myV

Re: how to find out utf or not

2013-11-05 Thread Steven D'Aprano
On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh wrote: > Dear all, > > Suppose i have a variable such as : myVar = 'x' > > May be it initialized with myVar = u'x' or myVar = 'x' Can't you just look at the code and tell which it is? > So i need determine content of myVar that it's utf

Re: how to find out utf or not

2013-11-05 Thread Neil Cerutti
On 2013-11-05, Dave Angel wrote: > On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh > 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

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On Tue, 05 Nov 2013 16:32:57 +0330, Mohsen Pahlevanzadeh 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 un

how to find out utf or not

2013-11-05 Thread Mohsen Pahlevanzadeh
Dear all, 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? --mohsen -- https://mail.python.org/mailman/listinfo/python-list