Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the British pound sign in an XML feed to be read by an iPhone

I have created a web-based UTF-8 XML feed for use in an iPhone application.

When viewing in a web browser, if the feed contains a British Pound sign, I get a nasty XML error: XML Parsing Error: undefined entity

However the actual file seems to be readable.

1. Will an iPhone NSParser be able to read the file or will it fail due to this character?

2. Is it possible to encode the pound sign for XML?

like image 796
Jon Winstanley Avatar asked Oct 08 '10 12:10

Jon Winstanley


People also ask

What is the code for a pound sign?

In the Unicode standard, the symbol £ is called POUND SIGN, and the symbol ₤ is the LIRA SIGN. These have respective code points: U+00A3 £ POUND SIGN ( £ · inherited from Latin-1)

How do I type the British pound symbol on my iPad?

On Android Devices123 button in the lower-left corner of the keyboard, then tap and hold your finger over the dollar ($) symbol. A list of currency symbols will pop up. Without lifting your finger from the touch screen, move it over to the pound sterling symbol and then release it.


2 Answers

if the feed contains a British Pound sign, I get a nasty XML error: XML Parsing Error: undefined entity

Your feed probably is using entity £ as the pound character. £ is a HTML entity and those can't be used without declaring them with DTD associated with (or embedded in) your XML document. If the entity is not defined, the XML parser will report that it has found an unknown entity.

Since you said your feed is encoded as UTF-8, you can just use the pound character as such - no need for an entity. Like LukeH suggested, other solution is to use the character reference £ which will be read as pound character by the XML parser.

like image 56
jasso Avatar answered Sep 27 '22 17:09

jasso


You could just use the £ entity.

like image 40
LukeH Avatar answered Sep 27 '22 17:09

LukeH