Created
May 7, 2013 05:33
-
-
Save kosugi/5530466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # ホームディレクトリにあったスクリプト. | |
| # 何に使ったんだっけか. | |
| # | |
| # ファイル名から推測するに, | |
| # 古い Gnumeric で日本語が EUC-JP で保存されていたものをサルベージしたか何か. | |
| import sys | |
| import re | |
| pat_ncr = re.compile(r'&#(\d+);') | |
| def refn_ncr2chr(m): | |
| return chr(int(m.group(1))) | |
| if __name__ == '__main__': | |
| sys.stdout.write(pat_ncr.sub(refn_ncr2chr, sys.stdin.read()).decode('EUC-JP').encode('UTF-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment