Commit 6c598cb0 authored by Stefan Behnel's avatar Stefan Behnel

fix encoding in file includes

parent 0395f26a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Pyrex Parser # Pyrex Parser
# #
import os, re import os, re, codecs
from string import join, replace from string import join, replace
from types import ListType, TupleType from types import ListType, TupleType
from Scanning import PyrexScanner from Scanning import PyrexScanner
...@@ -1178,8 +1178,9 @@ def p_include_statement(s, level): ...@@ -1178,8 +1178,9 @@ def p_include_statement(s, level):
if s.compile_time_eval: if s.compile_time_eval:
include_file_path = s.context.find_include_file(include_file_name, pos) include_file_path = s.context.find_include_file(include_file_name, pos)
if include_file_path: if include_file_path:
f = open(include_file_path, "rU") encoding = s.context.detect_file_encoding(include_file_path)
s2 = PyrexScanner(f, include_file_path, s) f = codecs.open(include_file_path, "rU", encoding=encoding)
s2 = PyrexScanner(f, include_file_path, s, source_encoding=encoding)
try: try:
tree = p_statement_list(s2, level) tree = p_statement_list(s2, level)
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment