Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 672701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:30:48+00:00 2026-05-14T00:30:48+00:00

I have a javascript that does this (http is your XMLHttpRequest object) var r

  • 0

I have a javascript that does this (http is your XMLHttpRequest object)

var r = http.responseXML.getElementsByTagName('item');

The issue is variable r is always an empty list if the response contains non-English character (r.length is 0).

The response header is correctly set
Content-Type: text/xml;charset=ISO-8859-1

This is what the response from the webserver looks like

<?xml version='1.0' encoding='UTF-8'?>
<d>
  <r>
    <item value="jmob" label="John Möb"/>
  </r>
</d>

It happens only in IE (both IE6 and IE8), works in Firefox and Chrome.
If items contain only English characters, it works fine.

Is there a workaround for this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:30:49+00:00Added an answer on May 14, 2026 at 12:30 am

    You said the response header was correctly set, but it’s not. You’re serving a UTF-8 document, so it should be:

    Content-Type: text/xml;charset=UTF-8

    There could be an issue with IE taking the content-type header literally. I can’t say I’ve ever run into this problem, but I don’t use getElementsByTagName because it doesn’t work with namespaces. You could use selectSingleNode() or selectNodes() instead:

    // Using recursive descent (//) to find all item nodes
    var r = http.responseXML.documentElement.selectNodes("//item");
    
    // Specifying the exact path to the item nodes
    var r = http.responseXML.documentElement.selectNodes("r/item");
    

    XPath gives you much more power than getElementsByTagName. You might even find that, using the right path, you can ditch one or two of your if statements. For full XPath syntax, see http://msdn.microsoft.com/en-us/library/ms256471(VS.85).aspx.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's a tortured way you might be able to do… May 16, 2026 at 5:44 pm
  • Editorial Team
    Editorial Team added an answer Have you checked the web.config? Whenever i've dragged a chart… May 16, 2026 at 5:44 pm
  • Editorial Team
    Editorial Team added an answer Well, you don't need a loop to use iterators: vector<Desempenho>::const_reverse_iterator… May 16, 2026 at 5:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a javascript that has custom indexes, I created them like so: var
I have a web service (ASMX) and in it, a web method that does
I have a photo gallery I would like that every time a user does
I have some javascript inside an iframe that sends the height of the iframe
I am currently trying to implement this into my current code: http://cubiq.org/iscroll I have
We have a project that generates a code snippet that can be used on
I'm working on key handling in Javascript. I have done some research and I'd
I need a solution that will set the heights of two divs whose class
I've recently started doing some JSF work - before that I've always used PHP
In my site I use a CSS only dynamic menu. This is fine in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.