<p>I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a <code>°</code> character - <a href="http://en.wikipedia.org/wiki/Degree_symbol" rel="nofollow noreferrer">Unicode U+00B0</a> (which incidentally breaks the StackOverflow search function!). When my wxPython application tries to append that string to a text box I get a <code>UnicodeDecodeError</code>.</p>

<p>My first attempt to fix the issue simply caught that error (because the app apparently does send <em>some</em> bad messages. The problem is that the app also uses the character to report various temperatures around the unit and that's something we really need to log. Changing the source app is out of my control, so how can I detect and decode those symbols into something the <code>wxTextCtrl</code> can display?</p>

I can't say mych about wxPython itself, but I am guessing that it is trying to convert the text to Unicode before displaying it, If you have a string like
```
'123\xB0'
```
and try to convert it to Unicode with teh default encoding (ASCII) then it will throw
```
UnicodeDecodeError
```
. You can probably fix this by replacing
```
```
s = message.get_string()
```
```
with
```
```
s = message.get_string().decode('ISO8859-1')
```
```
(where I am assuming a function
```
get_string()
```
that gets the message as a string). The difference here is that by handong the conversion to Unicode yourself you get to specify the encoding.