Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encoding special characters
Message
From
13/12/2016 03:58:36
 
 
To
12/12/2016 16:47:47
General information
Forum:
ASP.NET
Category:
XML
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01644948
Message ID:
01644974
Views:
41
>I do not want to change the default Xml encoding which is:
>
>
><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>
>
>I also do not want to use CDATA.
>
>But, I need to encode special characters such as à to be & #224;.
>
>Is there any support at the Xml object that allows to encode some Xml content like this?

If you can type them you can use them. There are only six special characters and they have predefined entities :
" & quot;
& & amp;
' & apos;
< & lt;
> & gt;

If you can't type it can use & #224; If it occurs many times then you can define it as an entity reference so that it easily remembered:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sample [
      <!ENTITY agrave  "& #224"> 
]>
<Name>
    <First>Fred</First>
    <Last>H& agrave;bras</Last>
</Name>
NOTE: I've has to put a space after every occurrence of '&' above to show it properly. Here's how if looks without the space:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sample [
      <!ENTITY agrave  "à"> 
]>
<Name>
    <First>Fred</First>
    <Last>Hàbras</Last>
</Name>
Guess that's not a proper name tho :-{
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform