|
|
| |
// Standard includes | // Standard includes |
#include <stdlib.h> | #include <stdlib.h> |
|
#ifdef HAVE_ICONV |
#include <iconv.h> | #include <iconv.h> |
|
#endif |
#include <langinfo.h> | #include <langinfo.h> |
#include <locale.h> | #include <locale.h> |
#include <string.h> | #include <string.h> |
|
|
| |
static char *iconv_from_utf8_to_locale(const char *string, const char* fallback_string) | static char *iconv_from_utf8_to_locale(const char *string, const char* fallback_string) |
{ | { |
|
#ifdef HAVE_ICONV |
const size_t buffer_inc = 80; // Increment buffer size in 80 bytes step | const size_t buffer_inc = 80; // Increment buffer size in 80 bytes step |
const char *charset; | const char *charset; |
iconv_t cd; | iconv_t cd; |
|
|
if (dest_buffer != NULL) | if (dest_buffer != NULL) |
free(dest_buffer); // free buffer | free(dest_buffer); // free buffer |
free(src_buffer); // free string | free(src_buffer); // free string |
|
#endif // HAVE_ICONV |
return strdup(fallback_string); // and return fallback string | return strdup(fallback_string); // and return fallback string |
} | } |
| |