473,770 Members | 3,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Special character errors in XML page

XML gives an error when I have a £ sign (GBP) - £ - in a string.
I've fixed this by converting it to its HTML number.

In case other characters may cause the same error, I'm converting
characters to their HTML numbers that < 32 or 126 decimal.

Is this correct? What would you advise?

Thanking you in anticipation.
Dec 27 '07 #1
2 2465
withers wrote:
XML gives an error when I have a £ sign (GBP) - £ - in a string.
I've fixed this by converting it to its HTML number.

In case other characters may cause the same error, I'm converting
characters to their HTML numbers that < 32 or 126 decimal.

Is this correct? What would you advise?
Use an Unicode encoding like UTF-8 and an editor that supports that,
that way you certainly do not have to use numeric character references.
Even if you do not use Unicode you do not have to use numeric character
references for the pound sign, you just need to make sure you use an
encoding that contains that sign and you properly declare that encoding
in the XML declaration and you make sure your editor saves with the
declared encoding.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 28 '07 #2
On Dec 27, 3:32 pm, withers <ro...@upperbri dge.co.ukwrote:
XML gives an error when I have a £ sign (GBP) - £ - in a string.
You must either use an encoding which supports that character (and use
the XML Declaration to tell the processor which encoding you're using,
unless it's UTF8 or UTF16), or use the numeric escape. XML processing
generally uses Unicode internally, so it can handle just about every
character you've ever heard of and many you haven't -- but UTF8
requires characters above 127 be represented by multiple bytes, and of
course UTF16 starts out as a two-byte-per-character encoding.

Characters below space (32) -- the "control characters" -- are flat-
out illegal in XML 1.0. XML 1.1 relaxes this constraint, but is not
yet widely supported. The usual solution, if you must handle these, is
to do a base-64 encoding of your data before putting it into the XML
and reverse that before using it.

See the XML Recommendation for a discussion of which characters can,
and can't, be directly represented in XML. See the UTF8 spec for a
discussion of how its variable-length character encoding works.
Dec 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
47821
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
2
4560
by: Bal | last post by:
Hi, I am trying to generate a pdf using a XML file and rendering the page through XSL Stylesheet to a PDF. But the page has some special characters, as its for a chequ website. My Code below is <--xsl:page--> <?xml version="1.0" encoding="UTF-8"?>
4
432
by: Norman Uhlenkott | last post by:
I would like to be able to put in special character inside an xml data string (#, <, >, &). when it trys to parses out the XML String it errors out strXML = "<?xml version='1.0'?>" & vbCRLF strXML = strXML + "<WO_Step>" & vbCRLF strXML = strXML + "<Test>Test Special Characters #, %, &, <, > </Test> strXML = strXML + "</WO_Step>"
5
7114
by: Martin Eyles | last post by:
I get the following error:- c:\inetpub\wwwroot\ \analysis.aspx(1): Character is not valid. ^^^ (not a gap here, but I want to keep the folder name private) from the fist percent character in:- <%@ Page strict=true codeBehind="analysis.aspx.vb" aspCompat=true
20
9391
by: SMG | last post by:
Hi All, I have created an application which is working fine and is in about to launch, now suddenly my mgmt says there are chances that Scrip ID( a particular id and not prim key) may have special characters like '&,*,),( or /' This data(field/key) I am passing this value as a querystring. e.g. value to be passed : ABC http://localhost/myProj/abc.aspx?ScripID=ABC
8
1275
by: Colin Peters | last post by:
Hi, I'm reading a file and writing it to the html output for a page. I've come across two difficulties which I would like to solve. The files contain special characters from European alphabets, namely those which have the two little dots above the vowels called umlauts. Normally, these are rendered in html using "%auml;", but in the file
2
2291
by: Ozer | last post by:
Hi friends, I wanna ask something. I use javascript menu on my user interface. And the js files contains special(turkish) character. I need to use codepage=1254 attribute in my @Page tag. If i don't use it. Javascript menu and functions fail. But if i add this atrribute, after i posted the form, all of the special(turkish) characters becomes deleted. Thanks for any help. Bye.
2
5582
by: Diilb | last post by:
I am using DOM to create an rss feed. The problem I am running into is "special characters" such as é è ç. If I try adding them to the XML as character data (CData), DOM chokes and throws out errors. If I do a search and replace on the characters changing them to HTML entities instead of using CDATA, DOM chokes up again. If I do a combination of both (search and replace then add as Character Data) it does not choke, but the RSS...
3
10201
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want to read some regular expression tutorial. See the end of the article for links to online resources....
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.