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

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 moh...@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()

Re: how to find out utf or not

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

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-8 or

Re: how to find out utf or not

2013-11-05 Thread Gisle Vanem
Steven D'Aprano steve+comp.lang.pyt...@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,

Re: how to find out utf or not

2013-11-05 Thread Dave Angel
On 5 Nov 2013 15:30:19 GMT, Neil Cerutti ne...@norwich.edu wrote: On 2013-11-05, Dave Angel da...@davea.name 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