added protection against line terminators and other characters that might be transmitted over JSON UTF-8