Python Forum
'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte
#5
Okay, I found the source of the problem and the solution and, honestly, it was a bit dumb. I just didn't look very well into that.

When I was opening the new file for writing, I had done:

newFile = open(fileName, 'w+')
which used I don't know what encoding scheme. After opening as 'utf-8' for writing, the file works well with the subsequent converter.
For some reason, I wrongly assumed—unconsciously, actually—that after reading the contents with that encoding, they will be written in the same way to a new file.

Either way, you have taught me a lot here.

About your examples, they go beyond my understanding and knowledge at the time.

- C:\code would be a path to my code file?

- What does that λ mean?

- What is the difference between your first and second example? Just the same with different encoding depending on how you save the file?

I think I have too many questions about the test code.


Thank you very much, again.
Reply


Messages In This Thread
RE: 'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte - by karkas - Sep-07-2019, 02:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Search for multiple unknown 3 (2) Byte combinations in a file. lastyle 7 1,380 Aug-14-2023, 02:28 AM
Last Post: deanhystad
Question UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 562: ord ctrldan 23 4,890 Apr-24-2023, 03:40 PM
Last Post: ctrldan
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 16: invalid cont Melcu54 3 5,030 Mar-26-2023, 12:12 PM
Last Post: Gribouillis
  Decode string ? JohnnyCoffee 1 833 Jan-11-2023, 12:29 AM
Last Post: bowlofred
  extract only text strip byte array Pir8Radio 7 3,002 Nov-29-2022, 10:24 PM
Last Post: Pir8Radio
  [SOLVED] [Debian] UnicodeEncodeError: 'ascii' codec Winfried 1 1,037 Nov-16-2022, 11:41 AM
Last Post: Winfried
  sending byte in code? korenron 2 1,134 Oct-30-2022, 01:14 PM
Last Post: korenron
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 34: character Melcu54 7 19,070 Sep-26-2022, 10:09 AM
Last Post: Melcu54
  Byte Error when working with APIs Oshadha 2 1,022 Jul-05-2022, 05:23 AM
Last Post: deanhystad
  UnicodeEncodeError: 'ascii' codec can't encode character '\xfd' in position 14: ordin Armandito 6 2,745 Apr-29-2022, 12:36 PM
Last Post: Armandito

Forum Jump:

User Panel Messages

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