Cleaner version of explicit tag encoder.

This patch encoded explicit tag as context class, so no need
of additional param in encodeTag() function.

Unittest added.