The new forums will be named Coin Return (based on the most recent
vote)! You can check on the status and timeline of the transition to the new forums
here.
Special characters in Python
So I am writing a Python program that takes in text and had to analyze and sort it. I'm having a problem dealing with special characters in the input text. Examples:
Schröder becomes Schröder
Flüe becomes Flüe
Menchú becomes Menchú
Aysén becomes Aysén
Ibáñez becomes Ibáñez
I'd keep going, but I think you get the point.
So, what's the best way of dealing with those? I'd be ok with keeping the original accented letters or replacing them with plain letters. I just can't keep the gibberish it's outputting.
Thanks!
0
Posts
That helps, in that it finds the problem characters, but it removes them. If I use "replace" instead of "ignore", it puts in question marks instead. Neither options are good - I need letters of some kind. I need it to output "Schröder" or "Schroder", not "Schrder" or "Schr???der".
Sounds like the text being input/output isn't in unicode in order to accept them properly. Once you switch it, you shouldn't need to do anything more with it.
Something like this:
to read that back in you'd do this: