Repository: sunpy/sunpy

Issue:
OSError: Failed to load return from the HEKClient.
When trying to search for the flares on 2014/10/24 to /25, I get a "Failed to Load Return" error. 
Sunpy Version: 1.1.3

Here's a minimal reproducible example:

```
from sunpy.net import hek
client = hek.HEKClient()
tstart = '2014/10/24 20:50'
tend   = '2014/10/25 00:14'
event_type = 'FL'
client.search(hek.attrs.Time(tstart,tend),hek.attrs.EventType(event_type))
```



```python
Traceback (most recent call last):
  File "/home/user/anaconda3/envs/pytorch/lib/python3.8/site-packages/sunpy/net/hek/hek.py", line 69, in _download
    result = json.load(fd)
  File "/home/user/anaconda3/envs/pytorch/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/home/user/anaconda3/envs/pytorch/lib/python3.8/json/__init__.py", line 343, in loads
    s = s.decode(detect_encoding(s), 'surrogatepass')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 33279: invalid continuation byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/user/anaconda3/envs/pytorch/lib/python3.8/site-packages/sunpy/net/hek/hek.py", line 99, in search
    return self._download(ndata[0])
  File "/home/user/anaconda3/envs/pytorch/lib/python3.8/site-packages/sunpy/net/hek/hek.py", line 71, in _download
    raise IOError("Failed to load return from the HEKClient.") from e
OSError: Failed to load return from the HEKClient.
```


Discussion:
For the record, this is because byte `0xc5` corresponds to a unicode Angstrom character, which is present in the `.json` that the HEK client is trying to load at this location:

https://www.lmsal.com/hek/her?cosec=2&cmd=search&type=column&event_type=FL&x1=-5000&y1=-5000&x2=5000&y2=5000&event_coordsys=helioprojective&event_starttime=2014-10-24T20%3A50%3A00&event_endtime=2014-10-25T00%3A14%3A00&page=1

and the default python json reader does not like unicode characters.

Resolving patch:
diff --git a/sunpy/net/hek/hek.py b/sunpy/net/hek/hek.py
--- a/sunpy/net/hek/hek.py
+++ b/sunpy/net/hek/hek.py
@@ -1,8 +1,8 @@
 """
 Facilities to interface with the Heliophysics Events Knowledgebase.
 """
-
 import json
+import codecs
 
 import urllib
 from itertools import chain
@@ -59,7 +59,8 @@ def _download(self, data):
             data['page'] = page
             fd = urllib.request.urlopen(self.url+urllib.parse.urlencode(data))
             try:
-                result = json.load(fd)
+                result = codecs.decode(fd.read(), encoding='utf-8', errors='replace')
+                result = json.loads(result)
             except Exception as e:
                 raise IOError("Failed to load return from the HEKClient.") from e
             finally:


Test patch:
diff --git a/sunpy/net/tests/test_hek.py b/sunpy/net/tests/test_hek.py
--- a/sunpy/net/tests/test_hek.py
+++ b/sunpy/net/tests/test_hek.py
@@ -187,3 +187,16 @@ def test_mixed_results_get_2():
     assert isinstance(result, hek.hek.HEKTable)
     assert len(result) == 19
     assert result[0]["SOL_standard"] == 'SOL2011-08-08T01:30:04L247C075'
+
+
+@pytest.mark.remote_data
+def test_mixed_results_get_angstrom():
+    # To check that the following bug is fixed:
+    # https://github.com/sunpy/sunpy/issues/4087
+    client = hek.HEKClient()
+    tstart = '2014/10/24 20:50'
+    tend = '2014/10/25 00:14'
+    event_type = 'FL'
+    result = client.search(hek.attrs.Time(tstart, tend), hek.attrs.EventType(event_type))
+    assert len(result) == 13
+    assert result[0]["SOL_standard"] == 'SOL2014-10-24T20:53:46L247C106'