Use wcstombs when iconv is not present (#223)

Replace the jerry-built UTF-16 => Latin-1 code path with a cross-platform wcstombs solution that emits UTF-8.

This adds an element to the end of the MdbHandle struct, but should not break any existing code.

A run-time option could be added later to emit other encodings, but people who care about such things can just use the iconv code path.
This commit is contained in:
Evan Miller
2020-12-20 17:56:33 -05:00
committed by GitHub
parent fb6637c503
commit a8414720e4
4 changed files with 47 additions and 11 deletions

View File

@@ -39,6 +39,11 @@
#ifdef HAVE_ICONV
#include <iconv.h>
#else
#ifdef HAVE_XLOCALE_H
#include <xlocale.h>
#endif
#include <locale.h>
#endif
#ifdef _WIN32
@@ -291,6 +296,10 @@ typedef struct {
#ifdef HAVE_ICONV
iconv_t iconv_in;
iconv_t iconv_out;
#elif defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || defined(WINDOWS)
_locale_t locale;
#else
locale_t locale;
#endif
} MdbHandle;