fixed encoding problime while compression
This commit is contained in:
parent
f037286459
commit
75019ba98b
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@ from jsmin import jsmin
|
|||||||
|
|
||||||
|
|
||||||
content = ""
|
content = ""
|
||||||
with open('index.html','rt') as f:
|
with open('index.html','rt',encoding="utf-8") as f:
|
||||||
content=f.read()
|
content=f.read()
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +22,6 @@ import re
|
|||||||
regex = r"<script>(.+?)<\/script>"
|
regex = r"<script>(.+?)<\/script>"
|
||||||
content = re.sub(regex, lambda x: "<script>"+jsmin(x.group(1))+"</script>" ,content, 0, re.DOTALL)
|
content = re.sub(regex, lambda x: "<script>"+jsmin(x.group(1))+"</script>" ,content, 0, re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
#with gzip.open('htmltest.html.gz', 'wb') as f:
|
|
||||||
# f.write(content.encode("UTF-8"))
|
|
||||||
|
|
||||||
#with open('htmltest.html.z','wb') as f:
|
|
||||||
# f.write(zlib.compress(content.encode("UTF-8"),9))
|
|
||||||
|
|
||||||
result =""
|
result =""
|
||||||
for c in zlib.compress(content.encode("UTF-8"),9):
|
for c in zlib.compress(content.encode("UTF-8"),9):
|
||||||
result= result + ("0x%02X" %c)
|
result= result + ("0x%02X" %c)
|
||||||
|
Loading…
Reference in New Issue
Block a user