added debug logging for unicode errors