Add exception handling and file support
Revert "Add exception handling and file support"

This reverts commit ff28a30587b5d3910cb540e79a272690511e34e0.
Revert "Revert "Add exception handling and file support""

This reverts commit 07bf06fa33933cdb51716d5bf059cc5c60a53633.
Force to use UTF-8 encoding