Fixed error on some browsers when printing invalid characters