Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
codec for byte transparency
#1
given "random" bytes in the range from 0 to 255, such as from a file containing machine executable code, i would like to convert this "byte sequence" to str type without applying any UTF-8, or any other, interpretation to it. the following code can do this:
# convert bytes in b to str in s without any encoding
s = ''.join(chr(x)for x in b)
what codec would do the same thing in decode or the exact reverse in encode (when every str character has an ord() value of 255 or lower)?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
codec for byte transparency - by Skaperen - Sep-18-2020, 02:24 AM
RE: codec for byte transparency - by bowlofred - Sep-18-2020, 03:01 AM
RE: codec for byte transparency - by Skaperen - Sep-18-2020, 03:12 AM
RE: codec for byte transparency - by DeaD_EyE - Sep-18-2020, 06:56 AM
RE: codec for byte transparency - by bowlofred - Sep-18-2020, 07:23 AM
RE: codec for byte transparency - by Skaperen - Sep-18-2020, 10:35 PM
RE: codec for byte transparency - by bowlofred - Sep-18-2020, 11:06 PM
RE: codec for byte transparency - by Skaperen - Sep-25-2020, 02:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 16: invalid cont Melcu54 3 4,995 Mar-26-2023, 12:12 PM
Last Post: Gribouillis
  [SOLVED] [Debian] UnicodeEncodeError: 'ascii' codec Winfried 1 1,033 Nov-16-2022, 11:41 AM
Last Post: Winfried
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 34: character Melcu54 7 19,005 Sep-26-2022, 10:09 AM
Last Post: Melcu54
  ASCII-Codec in Python3 [SOLVED] AlphaInc 4 6,148 Jul-07-2021, 07:05 PM
Last Post: AlphaInc
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call AkaAndrew123 1 3,454 Apr-28-2021, 08:16 AM
Last Post: AkaAndrew123
  'utf-8' codec can't decode byte 0xe2 in position 122031: invalid continuation byte tienttt 12 11,565 Sep-18-2020, 10:10 PM
Last Post: tienttt
  'charmap' codec louis216 4 20,190 Jun-30-2020, 06:25 AM
Last Post: louis216
  'utf-8' codec can't decode byte 0xda in position 184: invalid continuation byte karkas 8 31,699 Feb-08-2020, 06:58 PM
Last Post: karkas
  Which codec can help me decode the html source? vivekagrey 4 3,190 Jan-10-2020, 09:33 AM
Last Post: DeaD_EyE
  unicodedecodeerror:utf codec can't decode byte 0xe3 in position 1 mariolopes 3 2,822 Oct-14-2019, 10:17 PM
Last Post: mariolopes

Forum Jump:

User Panel Messages

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