## Input and output encoding

CTPL does no encoding conversion magic for you. The main reason for this is that it's a complex task to handle encodings properly, and it has a cost in performances. Moreover, CTPL can (should) work with any US-ASCII-compatible encoding, which includes UTF-8, ISO-8859-*, and many others — but not UTF-16, UTF-32 and a few others.

Since CTPL will not convert anything for you, you must ensure that the encoding of the input template and the environment are the same to avoid mixed encodings in the output.

To convert the input data, you can use a GConverterInputStream and/or a GConverterOutputStream together with a GCharsetConverter as the input or output source to do an implicit charset conversion directly on reads and/or writes. You can of course also do a manual conversion, with g_convert() or g_iconv() for example.

The recommended encoding for the data to pass to CTPL is UTF-8, but, as said above, any US-ASCII-compatible encoding should work perfectly fine.