Fixed the UTF-8 errors for source codes with invalid characters