Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

75%
+4 −0
Meta How should I organize material about text encoding in Python into questions?

The list you provided seems huge for a single Q/A. I think you're better off breaking them up, and linking to each other in the answers. The theory behind text encoding can be decoupled from Python...

posted 8mo ago by Andreas from the dark caverns‭

Answer
#1: Initial revision by user avatar Andreas from the dark caverns‭ · 2023-08-29T21:43:40Z (8 months ago)
The list you provided seems huge for a single Q/A. I think you're better off breaking them up, and linking to each other in the answers. The theory behind text encoding can be decoupled from Python, as it's relevant to the whole world of programming. If you already know about text encoding, and how it works, but you're just looking for how to use it, perhaps because you forgot, or because you're coming from a different language, it's unnecessary to scroll through a long description of what it is, first.

> What are UnicodeEncodeError and UnicodeDecodeError? What do they mean; what causes them; and how do I resolve them?

This could be a debugging Q/A for text encoding in Python.

> How do I specify an encoding...
>
> - for converting bytes to a string or vice-versa?
> - for reading and writing files?
> - when working with web libraries such as Requests, BeautifulSoup etc.?
> - when using a library to parse formats like CSV, JSON etc.?

These don't belong in one and the same Q/A. Have a separate Q/A for each one of them. You can give a broad overview of strings vs blobs, though, in an explanation specific to Python.

> What is the codecs standard library module for, and how does it relate to text encoding? 

Probably works best as a separate Q/A.

> - Historical: in Python 2.x, why can attempts to decode cause UnicodeEncodeError, and vice-versa?
> - Historical / migration: how should I understand the type names bytes, str and unicode in 2.x vs 3.x?
> - Historical: What was basestring in 2.x and why was it needed?
> - Historical / migration: why did 2.x treat those types the way it did, and why does 3.x treat them differently? Why shouldn't I try to emulate the old approaches in new code?

These can either be separate Q/As, tagged accordingly, or coupled together in a "text encoding in Python 2 vs Python 3" Q/A.