Skip to content

Instantly share code, notes, and snippets.

@kosugi
Created December 1, 2013 09:55
Show Gist options
  • Select an option

  • Save kosugi/7730661 to your computer and use it in GitHub Desktop.

Select an option

Save kosugi/7730661 to your computer and use it in GitHub Desktop.
echo 深夜徘徊 | enspeed.py
#! /usr/bin/env python
from unicodedata import category
PREFIX = u'\u003D\u035E\u035F\u035F\u035E'
def do(istream, ostream):
for c in istream.read():
if category(c) not in ['Cc', 'Zs']:
ostream.write(PREFIX)
ostream.write(c)
if __name__ == '__main__':
import sys
import codecs
sys.stdin = codecs.getreader('UTF-8')(sys.stdin)
sys.stdout = codecs.getwriter('UTF-8')(sys.stdout)
do(sys.stdin, sys.stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment