1 Reply Latest reply: Nov 19, 2008 5:23 AM by 800322 RSS

    Problem in XML character encoding


      i am using ajax for fetching data from server.i use java for business logic.when i am calling HttpServlet's doGet() method from ajax ,i append the server data in the form of xml like <partner>(server date)</partner>.My problem is,if the server data contains any special characters like '&'(for instance D & K),'''(for instance S'K),i got null from xml pattern.i implement UTF-8 character encoding,but i am unable to solve my problem myself,so which character encoding will be the best to support all the characters including mentioned above(&,',% and so),because my application is an online application,so no one cannot be restricted from entering these characters,help me to solve this problem,otherwise i will have to update from backend for every user of my application.

      my ajax coding :

      function validateCallbackForPartners(responseXML) {
      var partnerIdArray               = new Array();
      var partnerNameArray          = new Array();
      var employees           =responseXML.getElementsByTagName"employees")[0]//null

      java coding :

      for(int i =0;i < returnedPartnerNameArray.length ;i++) {
      if(!"".equals(returnedPartnerNameArray)) {
           sbResp.append("<partnerid>"+returnedPartnerIdArray[i]+"</partnerid>");//server data append
           namesAdded     = true;
      if(namesAdded) {
      response.setHeader("Cache-Control", "no-cache");
      response.getWriter().write("<employees>" + sbResp.toString() + "</employees>");

      thanks in advance


      Oasis Deserts