Python Forum
how to decode UTF-8 in python 3
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to decode UTF-8 in python 3
#2
  • Use the method decode on bytes to decode to str (unicode)
  • Use the method encode on str to encode to bytes.
  • A str object does not have the method decode. It is already decoded.
  • A bytes object does not have the method encode. It is already encoded.

Then the standard complains:
  • don't use upper case in variable names, try not to use names like Str
  • post your code in code tags (BB-Code in the forum)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
how to decode UTF-8 in python 3 - by oco - Jun-05-2018, 08:44 AM
RE: how to decode UTF-8 in python 3 - by DeaD_EyE - Jun-05-2018, 09:09 AM
RE: how to decode UTF-8 in python 3 - by snippsat - Jun-05-2018, 10:40 AM
RE: how to decode UTF-8 in python 3 - by wavic - Jun-05-2018, 11:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Decode string ? JohnnyCoffee 1 936 Jan-11-2023, 12:29 AM
Last Post: bowlofred
  how to encode and decode same value absolut 2 2,509 Sep-08-2020, 09:46 AM
Last Post: TomToad
  python-resize-image unicode decode error Pedroski55 3 3,656 Apr-21-2020, 10:56 AM
Last Post: Pedroski55
  struct.decode() and '\0' deanhystad 1 3,421 Apr-09-2020, 04:13 PM
Last Post: TomToad
  Getting decode error. shankar 8 10,725 Sep-20-2019, 10:05 AM
Last Post: tinman
  charmap codec can't decode byte error with gzipped file in python bluethundr 2 3,920 Apr-30-2019, 12:26 PM
Last Post: bluethundr
  decode base64 with python give error thailq 3 4,035 Sep-24-2018, 12:39 AM
Last Post: thailq
  python charmap codec can't decode byte X in position Y character maps to < undefined> owais 9 39,688 Apr-28-2018, 10:52 PM
Last Post: abadawi
  Ask help for utf-8 decode/encode forfan 12 11,314 Feb-25-2017, 02:04 AM
Last Post: forfan

Forum Jump:

User Panel Messages

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