27#ifdef HAVE_LANGINFO_CODESET
32#include <libcharset.h>
50# define local_encoding get_local_encoding()
51# define data_encoding get_local_encoding()
52# define internal_encoding get_local_encoding()
93#ifdef HAVE_LANGINFO_CODESET
127#ifdef FREECIV_ENABLE_NLS
132 fprintf(
stderr,
"Encodings: Data=%s, Local=%s, Internal=%s\n",
139 _(
"You are running Freeciv without using iconv. Unless\n"
140 "you are using the UTF-8 character set, some characters\n"
141 "may not be displayed properly. You can download iconv\n"
142 "at https://gnu.org/.\n"));
166# ifdef HAVE_LIBCHARSET
169# ifdef HAVE_LANGINFO_CODESET
248 const char *
mytext = text;
262 if (
res == (
size_t) (-1)) {
266 fprintf(
stderr,
"Invalid string conversion from %s to %s: %s.\n",
307#define CONV_FUNC_MALLOC(src, dst) \
308char *src ## _to_ ## dst ## _string_malloc(const char *text) \
310 const char *encoding1 = (dst ## _encoding); \
311 char encoding[strlen(encoding1) + strlen(transliteration_string) + 1]; \
313 fc_snprintf(encoding, sizeof(encoding), \
314 "%s%s", encoding1, transliteration_string); \
315 return convert_string(text, (src ## _encoding), \
316 (encoding), NULL, 0); \
319#define CONV_FUNC_BUFFER(src, dst) \
320char *src ## _to_ ## dst ## _string_buffer(const char *text, \
321 char *buf, size_t bufsz) \
323 const char *encoding1 = (dst ## _encoding); \
324 char encoding[strlen(encoding1) + strlen(transliteration_string) + 1]; \
326 fc_snprintf(encoding, sizeof(encoding), \
327 "%s%s", encoding1, transliteration_string); \
328 return convert_string(text, (src ## _encoding), \
329 encoding, buf, bufsz); \
332#define CONV_FUNC_STATIC(src, dst) \
333char *src ## _to_ ## dst ## _string_static(const char *text) \
335 (src ## _to_ ## dst ## _string_buffer)(text, \
337 sizeof(convert_buffer)); \
338 return convert_buffer; \
size_t get_internal_string_length(const char *text)
#define CONV_FUNC_BUFFER(src, dst)
static char convert_buffer[4096]
static const char * transliteration_string
void fc_iconv_close(void)
#define CONV_FUNC_MALLOC(src, dst)
const char * get_data_encoding(void)
#define internal_encoding
static char * convert_string(const char *text, const char *from, const char *to, char *buf, size_t bufsz) fc__attribute((nonnull(1
const char * get_internal_encoding(void)
#define CONV_FUNC_STATIC(src, dst)
static char void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration)
const char * get_local_encoding(void)
#define FC_DEFAULT_DATA_ENCODING
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
#define fc_assert_ret_val(condition, val)
static int recursion[AIT_LAST]
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_strcasecmp(const char *str0, const char *str1)
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)