Example of overriding your own Encoding.

Previously I wrote about the Best Way to Make Your Own Encoding, but didn't include an example, so today I'm including an example of a replacement Encoding.  I also included an EncoderFallback example, which replaces unknown characters with numerical entity style replacements (〹). 

This example isn't complete.  If you need Encoder or Decoder functionality you'd have to override those as well.  Also I didn't include a DecoderFallback example.  From this example those should be reasonably straight forward.  The biggest issues are that Encoders/Decoders maintain state such as lead bytes or high surrogates, so they may have data buffered from a previous conversion.

I included a simple Main that just converts some text to bytes and back.  Its not very pretty, but it demonstrates that something did actually happen :)  Be forwarned that I spent almost no time testing this sample, so caveat programmer!  As always this sample is provided as-is with no warrenties or guarantees.

Hope you find this helpful,

Shawn

EncodingSample.cs