Posts: 7,092
Threads: 122
Joined: Sep 2016
Aug-24-2019, 01:30 PM
(This post was last modified: Aug-24-2019, 01:30 PM by snippsat.)
(Aug-23-2019, 11:54 PM)adnanahsan Wrote: but on terminal some thing is wrong. strange issue i am facing bro :(
for example
i see this " Bebês " in terminal instead of " Bebês " This is a typical error that can come if run Python 2,are you sure you running python 3 on server?
# Python 3.7
>>> s = 'Bebês'
>>> print(s)
Bebês
# Python 2.7,the error you get
>>> s = 'Bebês'
>>> print(s)
Bebês
# Python 2.7 fix
>>> s = u'Bebês'
>>> print(s)
Bebês Put in sys.executable in script so see what python version you run.
import sys
print(sys.executable)
s = u'Bebês'
print(s)
Posts: 12
Threads: 3
Joined: Aug 2019
Aug-24-2019, 09:51 PM
(This post was last modified: Aug-24-2019, 09:51 PM by adnanahsan.)
ok see here http://prntscr.com/ox21gf
when i simply entered s = 'Bebês' and press enter key, see in the image what i got, this is the issue ..
i tried s = u'Bebês' too, same error.
python version is 3.6
And on python 2 its showing like this
>>> s = u'Bebês'
>>> print(s)
Bebês i tried this on 2 servers, same issue on both server .. working fine on my windows pc though, and also on my ubuntu installed on vmware on my windows pc.. but problem is only on servers
(Aug-24-2019, 01:30 PM)snippsat Wrote: (Aug-23-2019, 11:54 PM)adnanahsan Wrote: but on terminal some thing is wrong. strange issue i am facing bro :(
for example
i see this " Bebês " in terminal instead of " Bebês " This is a typical error that can come if run Python 2,are you sure you running python 3 on server?
# Python 3.7
>>> s = 'Bebês'
>>> print(s)
Bebês
# Python 2.7,the error you get
>>> s = 'Bebês'
>>> print(s)
Bebês
# Python 2.7 fix
>>> s = u'Bebês'
>>> print(s)
Bebês Put in sys.executable in script so see what python version you run.
import sys
print(sys.executable)
s = u'Bebês'
print(s)
Posts: 12
Threads: 3
Joined: Aug 2019
Hello everyone,
i am facing a strange issue for last several days, no one could solve this problem so far for me..
i am sharing the problem in a simple words here
Whenever i enter this line or similar in my server python3.6 and 3.7 versions. i got unicodedecodeerror.
>>> s = 'Bebês' exactly after this line i get error. http://prntscr.com/ox21gf
this is causing the problem i am unable to match / query such unicode strings in mysql too
btw this is all working perfectly on my Windows PC .. and a ubuntu linux i installed on VMWare on my Windows PC .
But on my servers, i am facing the above problem .. i am waiting for your replies guyz, Kindly help me out.
Python version i am using is 3.6 and 3.7
Thanks
Posts: 212
Threads: 25
Joined: Aug 2019
Hi!
Have you tried using the unicode number inside the string as here in my s2 variable?:
s1 = 'Bebês'
s2 = "Beb\u00EAs"
s3 = '\u00EA'
print(s1, s2, s3) that produces the following output (on my Windows PC, so I'm not sure if it will work on your servers):
Output: Bebês Bebês ê
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Posts: 8,090
Threads: 154
Joined: Sep 2016
what is the system locale?
(Aug-26-2019, 11:55 PM)adnanahsan Wrote: i am facing a strange issue for last several days, Also - did it work before that, i.e. any recollections what have you done/ change "several days" ago?
Posts: 7,092
Threads: 122
Joined: Sep 2016
Aug-27-2019, 10:03 AM
(This post was last modified: Aug-27-2019, 10:03 AM by snippsat.)
You should at least make a link to your previous Thread.
(Aug-27-2019, 08:44 AM)buran Wrote: what is the system locale? I have already ask about this in previous Thread.
Posts: 8,090
Threads: 154
Joined: Sep 2016
Aug-27-2019, 10:23 AM
(This post was last modified: Aug-27-2019, 10:23 AM by buran.)
(Aug-27-2019, 10:03 AM)snippsat Wrote: I have already ask about this in previous Thread. I was away for few days and still catching-up with the old threads. I think we need to lock this thread or even soft-delete it. I merge it into the first one
Posts: 12
Threads: 3
Joined: Aug 2019
Locale is utf-8. Or en_us utf-8
I m just trying to have someone who can identify the issue
Posts: 8,090
Threads: 154
Joined: Sep 2016
I am fairly sure your terminal encoding is latin-1 not utf-8
Can you provide a screenshot for the output of $ locale on your server terminal?
Posts: 12
Threads: 3
Joined: Aug 2019
http://prntscr.com/oy8j83 see this, can you tell me how can i solve this issue
(Aug-27-2019, 11:44 AM)buran Wrote: I am fairly sure your terminal encoding is latin-1 not utf-8
Can you provide a screenshot for the output of $ locale on your server terminal?
|