fixing encoding problems when using utf-8 in scripts