Skip to content

Commit bcfbb51

Browse files
committed
fix unicode characters and line break
1 parent 1a7f88f commit bcfbb51

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

zap2xml.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def on_td (self, tag, attrs):
333333
if cp != -1 and "-D" in options:
334334
fn = os.path.join(cacheDir,cp + ".js.gz")
335335
if not os.path.isfile(fn):
336-
data = getURL(urlRoot + "gridDetailService?pgmId=" + cp)
336+
data = unicode(getURL(urlRoot + "gridDetailService?pgmId=" + cp), 'utf-8')
337337
wbf(fn, data)
338338
log.pout("[D] Parsing: " + cp,'info')
339339
parseJSOND(fn)
@@ -1228,37 +1228,15 @@ def enc(strng):
12281228
global options
12291229
t = strng
12301230
if "-E" not in options:
1231-
t = re.sub("& ","& ",t)
1231+
t = re.sub("&","&",t)
12321232
t = re.sub("\"",""",t)
12331233
t = re.sub("\'","'",t)
12341234
t = re.sub("<","&lt;",t)
12351235
t = re.sub(">","&gt;",t)
12361236
t = re.sub("``","&quot;",t)
12371237
t = re.sub("\'\'","&quot;",t)
12381238
t = re.sub("&apos;&apos;","&quot;",t)
1239-
t = re.sub("&Aacute;","&#xc4;",t)
1240-
t = re.sub("&aacute;","&#xe1;",t)
1241-
t = re.sub("&Atilde;","&#xc3;",t)
1242-
t = re.sub("&atilde;","&#xe3;",t)
1243-
t = re.sub("&Eacute;","&#xc9;",t)
1244-
t = re.sub("&eacute;","&#xe9;",t)
1245-
t = re.sub("&Iacute;","&#xcd;",t)
1246-
t = re.sub("&iacute;","&#xed;",t)
1247-
t = re.sub("&Ntilde;","&#xd1;",t)
1248-
t = re.sub("&ntilde;","&#xf1;",t)
1249-
t = re.sub("&Oacute;","&#xd3;",t)
1250-
t = re.sub("&oacute;","&#xf3;",t)
1251-
t = re.sub("&Uacute;","&#xda;",t)
1252-
t = re.sub("&uacute;","&#xfa;",t)
1253-
t = re.sub("&Uuml;","&#xdc;",t)
1254-
t = re.sub("&uuml;","&#xfc;",t)
1255-
t = re.sub("&laquo;","&#xab;",t)
1256-
t = re.sub("&raquo;","&#xbb;",t)
1257-
t = re.sub("&iquest;","&#xbf;",t)
1258-
t = re.sub("&iexcl;","&#xa1;",t)
1259-
t = re.sub("&euro;","&#x80;",t)
1260-
t = re.sub("&sup3;","&#xb3;",t)
1261-
t = re.sub("&copy;","&#xa9;",t)
1239+
12621240
else:
12631241
if re.search("amp",options["-E"]): t = re.sub("&[^#]","&amp; ",t)
12641242
if re.search("quot",options["-E"]): t = re.sub("\"","&quot;",t)

0 commit comments

Comments
 (0)