How to deactivate % as special character?

You can make % punctuation character by

\catcode`\%=12

In ConTeXt you can use ASCII mode by saying \asciimode. This will disable the special meaning of #$%&^_|~ for the whole document from that point. You can still have comments with double percent signs.

\asciimode
\starttext

#$%&^_|~  %% these are disabled

\ { }     %% these remain enabled

\stoptext

If you only want to enable it for a short piece of text, use \start...\stopasciimode.

\starttext

\startasciimode
  #$%&^_|~  %% these are disabled

  \ { }     %% these remain enabled
\stopasciimode

\stoptext

A category code assignment is of the form

\catcode <number> = <number>

(spaces and = are optional). The first <number> is the character we want to assign the category code (so eight bit in legacy engines, up to 0x10FFFF for Unicode engines), the second one is the category code (four bit number).

The number can be expressed in any legal form understood by TeX: decimal, octal, hexadecimal or alphabetic. For instance, the usual category code 4 to & can be assigned by

\catcode 38 = 4    % decimal
\catcode '46 = 4   % octal
\catcode "26 = 4   % hexadecimal
\catcode `& = 4    % alphabetic

In order to change the category code of %, which is preassigned to 14 when INITEX starts off, so embedded in every format that doesn't change the assignment, we have a problem if we want to use the “alphabetic” representation:

\catcode `% = 12

cannot work, because the % character has not yet been assigned a different category code, so it is still a comment character when the code is being read in. You can do it with the explicit number

\catcode 37 = 12

because % is ASCII 37 (hexadecimal 0x25). But it would be much handier to use the character! There is an escape to this cul-de-sac: an alphabetic constant can also be designed by

`\<character>

where the backslash must be a character of category code 0 (as usual). In this case the one character control sequence is not interpreted as a macro, but just as the character it is named with. Hence

\catcode `\% = 12

will work. Similarly, if you want to temporarily change the category code of the backslash to 12 you can do

\catcode `\\ = 12

(the assignment will be done after having input the control sequence \\ in order to interpret it as an alphabetic constant because of the backquote).

Other characters that must be denoted this way are those with category code 5 (end line), 9 (ignored) or 15 (invalid). Also category code 6 characters are better expressed this way, particularly when the category code assignment is in the replacement text of a macro.

Thus, when you have to change category code of a character (possibly) having category code 0 (escape), 5 (end line), 6 (parameter), 9 (ignored), 14 (comment) or 15 (invalid), use either the decimal form or the escaped form.