Some useful functions for switching between string encodings.