Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Encoding special characters
Message
De
13/12/2016 03:58:36
 
 
À
12/12/2016 16:47:47
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01644948
Message ID:
01644974
Vues:
42
>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 :-{
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform