#!/usr/bin/python

from __future__ import with_statement

import sys
import unicodedata

def convert(filename):
    with open(filename, 'r+') as file:
        s = file.read()
        s = s.decode('UTF-8')
        s = unicodedata.normalize('NFKC', s)
        s = s.encode('UTF-8')
        file.seek(0)
        file.truncate()
        file.write(s)

if __name__ == '__main__':
    for filename in sys.argv[1:]:
        convert(filename)

# vim:ts=4 sw=4 et
