diff --git a/html5lib/tests/test_encoding.py b/html5lib/tests/test_encoding.py
index <HASH>..<HASH> 100644
--- a/html5lib/tests/test_encoding.py
+++ b/html5lib/tests/test_encoding.py
@@ -54,7 +54,7 @@ def test_encoding():
 try:
     import chardet
     def test_chardet():
-        data = open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt")).read()
+        data = open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt"), "rb").read()
         encoding = inputstream.HTMLInputStream(data).charEncoding
         assert encoding[0].lower() == "big5"
 except ImportError:
Fix chardet test under Python 3 to read file as bytes