There was a bug when trying to convert the Hebrew string "\e0\e1\e2"
from WINDOWS-1255 to UTF-32LE, because there was a last call to
`iconv` with `NULL`s, without error checking, and buffer needed to
be extended for that last one call.
Now this call is inserted to the main `iconv` loop, with error checking.
Testcase: convert 1-byte encoded single character string from 125X to
UTF32, e.g. "=".
Expected result: got widestring, first dword contains "=", next dword
contains "\0"
Actual result: got widestring, first dword contains "=", second dword
contains garbage, next dword contains "\0"
Reference implementation:
http://www-personal.umich.edu/~bazald/l/api/_s_d_l__iconv_8c_source.html
, line 887
CP850 is used by the mortevielle engine (and apparently by other
engines too). Anytime an engine using CP850 encoding wants to use
the TTS, the encoding has to be converted, so this is pretty
important encoding conversion to support. Unfortunately SDL
(when compiled without iconv) doesn't support this encoding
(which means, there might not be a way to convert this encoding
on some platforms), so I added a conversion table for this.
Move #include<iconv.h> from common/encoding.h to
common/encoding.cpp and change the methods accordingly.
This resulted in not saving the iconvHandle if using the
"non-static" version of conversion, but it simplified the code
and hopefuly resolved issues with forbidden symbols on some
platforms.