Fix encoding bugs on ghmd script