support encoding std::strings, and also alow them as dictionary keys