Decoding and re encoding to proper type works correctly now

Also fixed a bug in the html encoder..
If you specify the input type as output type it won't decode and re-encode