astropy/astropy — pull request #817 by mdboom (2013-02-25 17:47:31+00:00)
Title: Coordinates and unicode

Hey folks,

I'm starting to use v0.2 in some of my work and it's really great! Thanks so much for all the work that you have all put in!

One issue that I've run into is that I get a `UnicodeDecodeError` when I pass a unicode string (I'm using 2.7 + `__future__.unicode_literals`) to the `ICRSCoordinates` constructor. The full traceback is attached. Encodings are the bane of my existence and I don't think that I really know enough to offer an opinion on what the best behaviour here is or if I'm just being thick. I'm happy to try to hack something (and offer a pull request) or leave it be depending on what you guys think.

Thanks again!

```
>>> from astropy.coordinates import ICRSCoordinates
>>> u = unicode("12h46m11.086s -00d30m11.99s")
>>> c = ICRSCoordinates(u)
...
File "/.../astropy/coordinates/angles.py", line 142, in __init__
if fromstr in angle:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)
>>> c = ICRSCoordinates(u.encode("utf-8"))
>>> # no problemo
```