Repository: getmoto/moto

Issue:
Moto reset API fails with an UnicodeDecodeError in moto 2.x 
Reset API is documented here: http://docs.getmoto.org/en/latest/docs/moto_apis.html

In the 2.x releases it fails with an UnicodeDecodeError, works fine in `1.3.16` and previous versions.

Test case:
```
import requests

@mock_s3
class TestMotoReset(unittest.TestCase):

    def test_reset(self):
        requests.post("http://motoapi.amazonaws.com/moto-api/reset")
...
```

Stack trace:
```
================================================================================= test session starts =================================================================================
platform linux -- Python 3.6.9, pytest-5.4.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python
collected 1 item                                                                                                                                                                      

src/test_moto_reset.py::TestMotoReset::test_reset FAILED                                                                                                                        [100%]

====================================================================================== FAILURES =======================================================================================
______________________________________________________________________________ TestMotoReset.test_reset _______________________________________________________________________________

self = <src.test_moto_reset.TestMotoReset testMethod=test_reset>

    def test_reset(self):
>       requests.post("http://motoapi.amazonaws.com/moto-api/reset")

src/test_moto_reset.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/dist-packages/requests/api.py:119: in post
    return request('post', url, data=data, json=json, **kwargs)
/usr/local/lib/python3.6/dist-packages/requests/api.py:61: in request
    return session.request(method=method, url=url, **kwargs)
/usr/local/lib/python3.6/dist-packages/requests/sessions.py:542: in request
    resp = self.send(prep, **send_kwargs)
/usr/local/lib/python3.6/dist-packages/requests/sessions.py:655: in send
    r = adapter.send(request, **kwargs)
/usr/local/lib/python3.6/dist-packages/responses.py:733: in unbound_on_send
    return self._on_request(adapter, request, *a, **kwargs)
/usr/local/lib/python3.6/dist-packages/responses.py:716: in _on_request
    response = adapter.build_response(request, match.get_response(request))
/usr/local/lib/python3.6/dist-packages/moto/core/models.py:231: in get_response
    result = self.callback(request)
/usr/local/lib/python3.6/dist-packages/moto/core/utils.py:190: in __call__
    result = self.callback(request, request.url, request.headers)
/usr/local/lib/python3.6/dist-packages/moto/core/responses.py:705: in reset_response
    moto_api_backend.reset()
/usr/local/lib/python3.6/dist-packages/moto/core/models.py:842: in reset
    for name, backends_ in backends.named_backends():
/usr/local/lib/python3.6/dist-packages/moto/backends.py:98: in named_backends
    yield name, _import_backend(module_name, backends_name)
/usr/local/lib/python3.6/dist-packages/moto/backends.py:87: in _import_backend
    module = importlib.import_module("moto." + module_name)
/usr/lib/python3.6/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:994: in _gcd_import
    ???
<frozen importlib._bootstrap>:971: in _find_and_load
    ???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:665: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:678: in exec_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
/usr/local/lib/python3.6/dist-packages/moto/support/__init__.py:2: in <module>
    from .models import support_backends
/usr/local/lib/python3.6/dist-packages/moto/support/models.py:9: in <module>
    ADVISOR_CHECKS = load_resource(resource_filename(__name__, checks_json))
/usr/local/lib/python3.6/dist-packages/moto/utilities/utils.py:22: in load_resource
    return json.load(f)
/usr/lib/python3.6/json/__init__.py:296: in load
    return loads(fp.read(),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.ascii.IncrementalDecoder object at 0x7f8cac461cf8>
input = b'{\n  "checks": [\n    {\n      "id": "Qch7DwouX1",\n      "name": "Low Utilization Amazon EC2 Instances",\n      "de...\n        "Limit Name",\n        "Limit Amount",\n        "Current Usage",\n        "Status"\n      ]\n    }\n  ]\n}\n'
final = True

    def decode(self, input, final=False):
>       return codecs.ascii_decode(input, self.errors)[0]
E       UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13950: ordinal not in range(128)

/usr/lib/python3.6/encodings/ascii.py:26: UnicodeDecodeError
------------------------------------------------------------ generated xml file: /opt/service/test-output/test_results.xml ------------------------------------------------------------
=============================================================================== short test summary info ===============================================================================
FAILED src/test_moto_reset.py::TestMotoReset::test_reset - UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13950: ordinal not in range(128)
================================================================================= 1 failed in 10.10s ==================================================================================

```



Discussion:

Resolving patch:
diff --git a/moto/utilities/utils.py b/moto/utilities/utils.py
--- a/moto/utilities/utils.py
+++ b/moto/utilities/utils.py
@@ -19,4 +19,4 @@ def load_resource(filename):
     load_resource(resource_filename(__name__, "resources/file.json"))
     """
     with open(filename, "r") as f:
-        return json.load(f)
+        return json.load(f, encoding="utf-8")


Test patch: