Python Forum
utf-8 decoding failed every time i try
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
utf-8 decoding failed every time i try
#12
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)
Reply


Messages In This Thread
RE: utf-8 decoding failed every time i try - by adnanahsan - Aug-24-2019, 09:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Decoding lat/long in file name johnmcd 4 546 Mar-22-2024, 11:51 AM
Last Post: johnmcd
  Enigma Decoding Problem krisarmstrong 4 911 Dec-14-2023, 10:42 AM
Last Post: Larz60+
  json decoding error deneme2 10 4,112 Mar-22-2023, 10:44 PM
Last Post: deanhystad
  flask app decoding problem mesbah 0 2,443 Aug-01-2021, 08:32 PM
Last Post: mesbah
  Decoding a serial stream AKGentile1963 7 9,015 Mar-20-2021, 08:07 PM
Last Post: deanhystad
  xml decoding failure(bs4) roughstroke 1 2,351 May-09-2020, 04:37 PM
Last Post: snippsat
  python3 decoding problem but python2 OK mesbah 0 1,864 Nov-30-2019, 04:42 PM
Last Post: mesbah
  hex decoding in Python 3 rdirksen 2 4,725 May-12-2019, 11:49 AM
Last Post: rdirksen
  Decoding log files in binary using an XML file. captainfantastic 1 2,513 Apr-04-2019, 02:24 AM
Last Post: captainfantastic
  decoding sub.process output with multiple \n? searching1 2 2,895 Feb-24-2019, 12:00 AM
Last Post: searching1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020