Merge pull request #481 from mxr/rm-type-ignore

Remove `type: ignore`
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f44bbeb..c5ccc79 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
 repos:
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v3.0.0
+    rev: v3.0.1
     hooks:
     -   id: trailing-whitespace
     -   id: end-of-file-fixer
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 209c03b..14230f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+3.0.1 - 2020-05-16
+==================
+
+### Fixes
+- `check-toml`: use UTF-8 encoding to load toml files
+    - #479 PR by @mxr.
+    - #474 issue by @staticdev.
+
 3.0.0 - 2020-05-14
 ==================
 
diff --git a/README.md b/README.md
index ee7036d..54db3a9 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
 
 ```yaml
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v3.0.0  # Use the ref you want to point at
+    rev: v3.0.1  # Use the ref you want to point at
     hooks:
     -   id: trailing-whitespace
     # -   id: ...
diff --git a/pre_commit_hooks/check_toml.py b/pre_commit_hooks/check_toml.py
index 51a1f15..8749675 100644
--- a/pre_commit_hooks/check_toml.py
+++ b/pre_commit_hooks/check_toml.py
@@ -13,8 +13,7 @@
     retval = 0
     for filename in args.filenames:
         try:
-            with open(filename) as f:
-                toml.load(f)
+            toml.load(filename)
         except toml.TomlDecodeError as exc:
             print(f'{filename}: {exc}')
             retval = 1
diff --git a/setup.cfg b/setup.cfg
index cae1b3b..cf04689 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = pre_commit_hooks
-version = 3.0.0
+version = 3.0.1
 description = Some out-of-the-box hooks for pre-commit.
 long_description = file: README.md
 long_description_content_type = text/markdown
diff --git a/tests/check_toml_test.py b/tests/check_toml_test.py
index 9f186d1..3283717 100644
--- a/tests/check_toml_test.py
+++ b/tests/check_toml_test.py
@@ -1,7 +1,7 @@
 from pre_commit_hooks.check_toml import main
 
 
-def test_toml_good(tmpdir):
+def test_toml_bad(tmpdir):
     filename = tmpdir.join('f')
     filename.write("""
 key = # INVALID
@@ -12,7 +12,7 @@
     assert ret == 1
 
 
-def test_toml_bad(tmpdir):
+def test_toml_good(tmpdir):
     filename = tmpdir.join('f')
     filename.write(
         """
@@ -27,3 +27,10 @@
     )
     ret = main((filename.strpath,))
     assert ret == 0
+
+
+def test_toml_good_unicode(tmpdir):
+    filename = tmpdir.join('f')
+    filename.write_binary('letter = "\N{SNOWMAN}"\n'.encode())
+    ret = main((filename.strpath,))
+    assert ret == 0