Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2293
chr.wiki.py
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:48 PM
2014-11-21 20:48:53 (UTC+0)
Size
344 B
Referenced Files
None
Subscribers
None
chr.wiki.py
View Options
#!/usr/bin/env python3.0
import
sys
import
re
_input
=
[
line
for
line
in
sys
.
stdin
.
readlines
()]
_print
=
""
_ws
=
re
.
compile
(
"&#x.{2,4};"
)
_ws2
=
re
.
compile
(
"&#x|;"
)
def
f_
(
mo
):
_s1
=
re
.
sub
(
_ws2
,
""
,
mo
.
group
(
0
))
return
chr
(
int
(
_s1
,
16
))
for
l
in
_input
:
if
_ws
.
search
(
l
):
_print
+=
re
.
sub
(
_ws
,
f_
,
l
)
else
:
_print
+=
l
print
(
_print
)
File Metadata
Details
Attached
Mime Type
text/x-python
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1869
Default Alt Text
chr.wiki.py (344 B)
Attached To
Mode
T5401: Dealing with non unicode aware browsers part 2
Attached
Detach File
Event Timeline
Log In to Comment