Commit 682dfec7 authored by Andreas Jung's avatar Andreas Jung

LP/#324876: tighened regex for detecing the charset

from a meta-equiv header
parent cc739963
...@@ -18,9 +18,8 @@ $Id: ZopePageTemplate.py 71579 2006-12-17 20:26:10Z andreasjung $ ...@@ -18,9 +18,8 @@ $Id: ZopePageTemplate.py 71579 2006-12-17 20:26:10Z andreasjung $
import re import re
xml_preamble_reg = re.compile(r'^<\?xml.*?encoding="(.*?)".*?\?>', re.M) xml_preamble_reg = re.compile(r'^<\?xml.*?encoding="(.*?)".*?\?>', re.M)
http_equiv_reg = re.compile(r'(<meta.*?http\-equiv.*?content-type.*?>)', re.I|re.M|re.S) http_equiv_reg = re.compile(r'(<meta\s+[^>]*?http\-equiv[^>]*?content-type.*?>)', re.I|re.M|re.S)
http_equiv_reg2 = re.compile(r'charset.*?=.*?(?P<charset>[\w\-]*)', re.I|re.M|re.S) http_equiv_reg2 = re.compile(r'charset.*?=.*?(?P<charset>[\w\-]*)', re.I|re.M|re.S)
def encodingFromXMLPreamble(xml): def encodingFromXMLPreamble(xml):
......
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