|
|
|
|
|
by make3
2810 days ago
|
|
isn't the correct practice to use errors="surrogateescape" for precisely this purpose with any encoding?
So in this case, you would use .decode("ascii", errors="surrogateescape") as the first bytes are the only ones you are sure of, and then .encode("ascii", errors="surrogateescape") to save again |
|