Greetings!
I have a web service (ASMX) and in it, a web method that does some work and throws an exception if the input wasn't valid.
throw new Exception(l_errMsg ?? "Invalid Input.");
Back in the client script, on the error callback function, I display my error:
function GetInputErrorCallback(error)
{
// Insert the error message into the Forgot Password help window's existing content.
var errorDiv = document.getElementById('input_error');
if (errorDiv != null)
errorDiv.innerHTML = error.get_message();
}
This works great. However, if one of my error messages that's returned contains a special character, it's displayed incorrectly in the browser.
For example, if the error message were to contain the following:
That input isn’t valid! (that's an ASCII #146 in there)
It displays this:
That input isn’t valid!
Or:
Do you like Hüsker Dü? (ASCII # 252)
Becomes:
Do you like Hüsker Dü?
The values returned by the web service (in the l_errMsg variable) look fine. It's just once the client script has a hold of, it displays incorrectly. How can I fix this? Thanks in advance.