I have a simple asp.net web application that uses YUI to request an Ajax. An application reads text from a text field and sends an AJAX request to the server. Below is the code
<body> <form id="form1" runat="server"> <div> <input id="txt" name="txt" type="text" value="[Enter some value]" /> <input id="btn" type="button" value="button" /> </div> <div id="out"></div> </form> </body>
Below is a client script that initializes an Ajax request
YAHOO.util.Event.onDOMReady(function() { YAHOO.util.Event.addListener("btn", "click", function(evt) { var url = "Server.aspx?type=test&txt=" + document.getElementById("txt").value; var btn = document.getElementById("out"); var cObj = YAHOO.util.Connect.asyncRequest('GET', url, { success: function(o) { btn.innerHTML += "<div>" + o.responseText + " = " + o.responseText.charCodeAt(0) + "</div>"; }, failure: function(o) { confirm("Its failure"); }, cache: false }); }); });
What I do in the application is a sign entered by the user, save it in db and write it in the Ajax response. The system does not support Unicode (database).
Now my problem is that when the symbol "Registered" ® (0174) is entered in the text box and sent to the server, I get # 65533, which is not what the user entered into the text box. In addition, this character is not a Unicode character, then why is this behavior.
source share