fixes thanks to cppcheck
enumeration for encodings
move ThirdParty code
primitives for proper encoding handling