ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626
diff --git a/Lib/test/test_coding.py b/Lib/test/test_coding.py
index ade8bdf..51873b4 100644
--- a/Lib/test/test_coding.py
+++ b/Lib/test/test_coding.py
@@ -17,10 +17,10 @@
 
         path = os.path.dirname(__file__)
         filename = os.path.join(path, module_name + '.py')
-        fp = open(filename, encoding='utf-8')
-        text = fp.read()
+        fp = open(filename, "rb")
+        bytes = fp.read()
         fp.close()
-        self.assertRaises(SyntaxError, compile, text, filename, 'exec')
+        self.assertRaises(SyntaxError, compile, bytes, filename, 'exec')
 
     def test_exec_valid_coding(self):
         d = {}
diff --git a/Lib/test/test_pep263.py b/Lib/test/test_pep263.py
index 72764f9..05ca47f 100644
--- a/Lib/test/test_pep263.py
+++ b/Lib/test/test_pep263.py
@@ -30,6 +30,12 @@
         else:
             self.fail()
 
+    def test_issue4626(self):
+        c = compile("# coding=latin-1\n\u00c6 = '\u00c6'", "dummy", "exec")
+        d = {}
+        exec(c, d)
+        self.assertEquals(d['\xc6'], '\xc6')
+
 def test_main():
     support.run_unittest(PEP263Test)