Bugfix: NULL termination

I found that a NULL termination may fail
when I'm making UTF-8 encoding file reading and writing support.