Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
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
 
Old February 16th, 2004, 08:54 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML - Special Character Formatting

Hi There,

I was wondering how I can save special characters to my xml document, at the
moment when I save something like the special character for pounds "£"
it gets saved to the xml document like "£". I was wondering how I can keep
the same format. for example if I save a character like "#8359;", when I
save it it turns into "#8359;". How can I stop this from happening ?

I have a select list that contains all of the currency codes.

Thanks in advance

'asp code

set OldcurrencyNode = objHdl.childNodes(11)
Set NewcurrencyNode = objXML.createElement("defaultcurrency")
Set NewcurrencyText = objXML.createTextNode(Request.Form("currency"))
NewcurrencyNode.appendChild(NewcurrencyText)
objHdl.replaceChild NewcurrencyNode, OldcurrencyNode

<select name="currency">
<option value="$">Australian Dollars</option>
<option value="$">United States Dollar</option>
<option value="£">United Kingdom Pounds</option>
<option value="$">Canada Dollars</option>
<option value="Â¥">China Yuan Renmimbi</option>
<option value="#8355;">France Francs</option>
<option value="DEM">Germany Deutche Marks</option>
<option value="$">Hong Kong Dollars</option>
<option value="£">Ireland Punt</option>
<option value="#8356;">Italy Lira</option>
<option value="Â¥">Japan Yen</option>
<option value="NLG">Netherlands (Dutch) Guilders</option>
<option value="$">New Zealand Dollars</option>
<option value="$">Singapore Dollars</option>
<option value="SAR">South Africa Rand</option>
<option value="#8359;">Spain Pesetas</option>
<option value="SEK">Sweden Krona</option>
<option value="#8355;">Switzerland Francs</option>


Regards,
Sean


 
Old February 17th, 2004, 08:59 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If I understand correctly the problem is caused by you using an incorrect encoding. How exactly are you saving the document?

Joe (MVP - xml)
 
Old February 17th, 2004, 05:37 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe,

When I save the XML document I just gather the information from all of the hiddden form fields and then use the following.

objXML.Save(Server.mappath("xml/payments.xml"))

 
Old February 18th, 2004, 05:17 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It could be done but why would you want to? You would have to double encode the symbols. This probably won't show well on a web page so I'll put asterisks between characters which you'll need to remove:
Code:
For &*#*8*3*5*9*; use &*a*m*p*;*#*8*3*5*9*;
As I said I'm not sure why you want this, if the sysmbols don't appear correctly it's because the file has a mismatched encoding with the declared one or the receiving reader handles it improperly.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing special character data mussitsch Classic ASP Professional 4 September 5th, 2006 02:29 PM
Validation for special character nazneen Java GUI 5 February 13th, 2006 03:13 PM
Decimal code for a special character mcinar HTML Code Clinic 14 February 4th, 2005 01:56 PM
Special Character mg1966 Classic ASP Databases 2 December 13th, 2004 11:12 AM
finding the string before a special character srini XSLT 2 December 16th, 2003 07:57 AM





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