Skip to content

Encode XML special characters by using simple C code

Notifications You must be signed in to change notification settings

melody26613/xml-encode-by-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xml-encode-by-C

Encode XML special characters by using simple C code

special characters entities
& &
' '
" "
< &lt;
> &gt;

WiKi reference

1. download repository

git clone https://github.com/melody26613/xml-encode-by-C.git

2. change path to xml-encode-by-C

cd xml-encode-by-C/

3. build code

make clean; make

4. use xml_encode, example:

./sample "&'\"<>"

result

input str: &'"<>

encode:    &amp;&apos;&quot;&lt;&gt;

decode:    &'"<>



./sample "&&&''\"<>>><"

result

input str: &&&''"<>>><

encode:    &amp;&amp;&amp;&apos;&apos;&quot;&lt;&gt;&gt;&gt;&lt;

decode:    &&&''"<>>><



./sample "&amp;&amp;&\"<&apos;>>><"

result: 

input str: &amp;&amp;&"<&apos;>>><

encode: &amp;amp;&amp;amp;&amp;&quot;&lt;&amp;apos;&gt;&gt;&gt;&lt;

decode: &amp;&amp;&"<&apos;>>><

5. unit test by googletest

please reference code under test/ and test/README.md

About

Encode XML special characters by using simple C code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published