Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 2nd, 2007, 06:06 PM
Registered User
 
Join Date: Dec 2004
Location: Indore, MP, India.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default French Characters in XML

Hi,

I have two drop down list control on a form DDL1 and DDL2. I am using AJAX Function (from W3Schools.com) to fill DDL2 on onchange event of the DDL1. On onchange event of DDL1 I am calling a javascript function that create a URL (a ASP Page link with some parameters). Now I am passing this URL in AJAX Function. The result for DDL2 is containing French characters like á,è,é and many more. All is fine I am receiving data but that is not populating in DDL2. The result contains small boxes instead of French characters.

I am getting data in "xml_second_list" variable. when I alert this variable it shows me data with small boxes instead of French Characters. When I evaluate following command line

if (objXmlDom.loadXML(xml_second_list))

It gives me FALSE.

Please tell me what step I am missing.


Thanks
Manish


  #2 (permalink)  
Old February 3rd, 2007, 01:12 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

When characters are passed from one piece of software to another, the two parties have to agree what encoding is being used. If they don't agree, for example if one party thinks the data is in iso-8859-1 and the other party thinks it is in utf-8, then you get this kind of problem.

You've described a moderately complex environment in which there are quite a few software components exchanging data with each other. It's quite impossible to tell from your description where the misunderstanding has arisen. You need to follow the path of a character through the system to work out at what point it is being misinterpreted by the recipient. Quite often it's the final stage that gets it wrong: the web server sends a page in one encoding, and the browser thinks it's in a different encoding. Check whether you can make this work with simple static HTML pages served to your browser, and if that works, gradually add complexity until you find the point of failure.

The problem may have something to do with XML, but it's more likely from what you've said that it doesn't.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old February 8th, 2007, 01:59 PM
Registered User
 
Join Date: Dec 2004
Location: Indore, MP, India.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Thanks Michael,

sorry for being late in reply. Actually I was busy with some other issues on my site.

If I save a file (say abc.xml) on my disk having French Characters without any encoding property it gives me error in my browser (IE7) but when I include encoding="iso-8859-1" it works fine and I can view French Characters in my browser. I have tried this in my ASP Page generated XML too, but still it is not showing me the French Characters.

My ASP page generats XML on the fly, it is not saving it anywhere. If I generate that XML and save it on my Disk I can view it in my browser.

Please give me some more guidance.

Thanks
Manish


  #4 (permalink)  
Old February 8th, 2007, 03:07 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Manish,

Have you tried setting the content type and charset in your asp page generating xml as well?
Code:
Response.ContentType = "text/xml"
Response.CharSet = "ISO-8859-1"
HTH,

Chris

  #5 (permalink)  
Old February 8th, 2007, 03:12 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sounds to me like a web server configuration issue, which means I'm out of my depth.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #6 (permalink)  
Old February 9th, 2007, 07:38 AM
Registered User
 
Join Date: Dec 2004
Location: Indore, MP, India.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Chris,

I was setting the content type only not the CharSet. as I include CharType settings, I got my problem solved. Thanks once again. After that I was getting special characters problem like "&" and all, so I include <![CDATA[ <data with special characters> ]]> while generating XML through ASP page and that too solved.

Thanks once again

Regards
Manish




Similar Threads
Thread Thread Starter Forum Replies Last Post
XML vs. special characters brko C# 1 January 23rd, 2006 11:05 AM
XML escape characters ACE2084 XML 0 September 9th, 2005 03:12 PM
Unrecognised XML characters crmpicco XML 3 May 20th, 2005 07:12 AM
German characters in XML/XSLT Norman Graham XSLT 12 January 29th, 2004 01:05 PM
XML and non displayable ASCII characters owain XML 2 June 12th, 2003 04:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.