If I hard-code this, everything is as expected:
var bytes = Utf8.parse('myString');
But this does return the same string as above.
var temp = String(getMyString());
var bytes = Utf8.parse(temp)
Here is my ajax call that calls the next code block.
function getMyString() {
$.ajax({
dataType: 'json',
type: 'post',
contentType: 'application/json',
url: '/Controller/GetString',
success: function (response) {
var obj = JSON.parse(response.Success);
return obj;
}
});
}
My Controller Calls the Next Code Block.
public JsonResult GetString()
{
var s = myClass.GetMyString();
return Json(new { Success = s });
}
In a static class
public static string GetMyString()
{
return "myString";
}
The End result is a thrown exception because the Byte array is off, because the input string is somehow not the same. I thought a async controller might be to blame, so that is my next attempt.