Xml Escaping/Encoding terminology

Yaron Naveh picture Yaron Naveh · Apr 18, 2009 · Viewed 7.3k times · Source

I'm confused as for the difference between the terms "escaping" and "encoding" in phrases like:

Xml Encoding

Xml Escaping

Encoded Html

Escaped Url

...

Can anyone explain it to me?

Answer

Welbog picture Welbog · Apr 18, 2009

Encoding describes how the file's characters are physically written in binary (as in Unicode or ANSI).

Escaping refers to the process of replacing special characters (such as < and >) with their XML entity equivalent (such as &lt; and &gt;). For URLs, escaping refers to replacing characters with strings starting with %, such as %20 for a single whitespace.

Escaping differs by language, but encodings are usually widely-accepted standards. Sometimes the terms are used ambiguously (particularly with encoding used to mean escaping), but they are well defined and distinct.