DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: UTF-8 Characters in AJAX Response

  1. #1
    Join Date
    Mar 2007

    UTF-8 Characters in AJAX Response

    **************** Apologies if you had run into this post at other Ajax forums *******************

    I've UTF-8 characters in the response string of XMLHttp request, below is how I see the response in the client browser(Firefox) :
    1) Firebug - <name>Cardenas " . </name>
    2) Javascript alert - <name>Cardenas " � �. </name>

    Question is why Javascript is failing to read the UTF-8 characters correctly? Thanks

  2. #2
    Join Date
    Mar 2007


    The problem was in the way we were writing the AJAX response on the server side, the code below fixed it :

    PrintWriter writer = new PrintWriter(newOutputStreamWriter(response.getOutputStream(), "UTF8"), true);
    response.setContentType("text/xml; charset=UTF-8");

Similar Threads

  1. Ajax and special characters
    By guerai78 in forum AJAX
    Replies: 5
    Last Post: 07-14-2008, 01:34 PM
  2. Drag and Drop with AJAX
    By waterbomm in forum AJAX
    Replies: 0
    Last Post: 10-05-2007, 02:11 AM
  3. using an AJAX function to return a value
    By k285715 in forum AJAX
    Replies: 0
    Last Post: 06-18-2007, 11:06 AM
  4. AJAX response contains original page!?!
    By Java_Maniac in forum AJAX
    Replies: 1
    Last Post: 12-29-2006, 06:29 AM
  5. New forum + some AJAX links
    By Lori in forum AJAX
    Replies: 0
    Last Post: 02-09-2006, 02:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center