Freeciv-3.2: /fast/freeciv/nightly/S3_2/utility/fciconv.h File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Macros | Functions
fciconv.h File Reference
`#include <stdio.h>`
`#include "shared.h"`

Go to the source code of this file.

## Macros

#define | FC_DEFAULT_DATA_ENCODING "UTF-8"
#define | fc_printf(...) fc_fprintf(stdout, __VA_ARGS__)

## Functions

void | init_character_encodings (const char *internal_encoding, bool use_transliteration)
void | fc_iconv_close (void)
const char * | get_data_encoding (void)
const char * | get_local_encoding (void)
const char * | get_internal_encoding (void)
char * | data_to_internal_string_malloc (const char *text)
char * | internal_to_data_string_malloc (const char *text)
char * | internal_to_local_string_malloc (const char *text)
char * | local_to_internal_string_malloc (const char *text)
char * | local_to_internal_string_buffer (const char *text, char *buf, size_t bufsz)
char * | internal_to_local_string_buffer (const char *text, char *buf, size_t bufsz)
void | fc_fprintf (FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
void size_t | get_internal_string_length (const char *text)

## Macro Definition Documentation

## ◆ FC_DEFAULT_DATA_ENCODING

#define FC_DEFAULT_DATA_ENCODING "UTF-8"

Definition at line 89 of file fciconv.h.

## ◆ fc_printf

#define fc_printf | ( |  | ... | ) | fc_fprintf(stdout, __VA_ARGS__)

Definition at line 109 of file fciconv.h.

## Function Documentation

## ◆ data_to_internal_string_malloc()

char * data_to_internal_string_malloc | ( | const char * | text | ) |

Referenced by get_conv().

## ◆ fc_fprintf()

void fc_fprintf | ( | FILE * | stream,
|  | const char * | format,
|  |  | ...
| ) |  |

Referenced by client_main(), cmdhelp_display(), dont_run_as_root(), fcmp_parse_cmdline(), get_option_malloc(), gui_ui_main(), log_callback_utf8(), log_parse_level_str(), log_real(), log_write(), main(), main(), parse_options(), print_usage(), print_usage(), print_usage(), qtg_ui_main(), re_parse_cmdline(), rup_parse_cmdline(), and setup_interrupt_handlers().

## ◆ fc_iconv_close()

void fc_iconv_close | ( | void |  | ) |

Free resources allocated by the iconv system

Definition at line 417 of file fciconv.c.

Referenced by libfreeciv_free().

## ◆ get_data_encoding()

const char * get_data_encoding | ( | void |  | ) |

Return the data encoding (usually UTF-8).

Definition at line 151 of file fciconv.c.

## ◆ get_internal_encoding()

const char * get_internal_encoding | ( | void |  | ) |

Return the internal encoding. This depends on the server or GUI being used.

Definition at line 182 of file fciconv.c.

Referenced by client_main(), main(), and srv_init().

## ◆ get_internal_string_length()

void size_t get_internal_string_length | ( | const char * | text | ) |

Return the length, in characters, of the string. This can be used in place of strlen() in some places because it returns the number of characters not the number of bytes (with multi-byte characters in UTF-8, the two may not be the same).

Use of this function outside of GUI layout code is probably a hack. For instance the demographics code uses it, but this should instead pass the data directly to the GUI library for formatting.

Definition at line 395 of file fciconv.c.

Referenced by cmafec_get_result_descr(), dem_line_item(), helptext_extra(), insert_generated_text(), insert_veteran_help(), and report_demographics().

## ◆ get_local_encoding()

const char * get_local_encoding | ( | void |  | ) |

Return the local encoding (dependent on the system).

Definition at line 160 of file fciconv.c.

## ◆ init_character_encodings()

void init_character_encodings | ( | const char * | my_internal_encoding,
|  | bool | my_use_transliteration
| ) |  |

Must be called during the initialization phase of server and client to initialize the character encodings to be used.

Pass an internal encoding of NULL to use the local encoding internally.

Definition at line 70 of file fciconv.c.

Referenced by client_main(), fcmp_init(), main(), and srv_init().

## ◆ internal_to_data_string_malloc()

char * internal_to_data_string_malloc | ( | const char * | text | ) |

Referenced by put_conv().

## ◆ internal_to_local_string_buffer()

char * internal_to_local_string_buffer | ( | const char * | text,
|  | char * | buf,
|  | size_t | bufsz
| ) |  |

Referenced by client_start_server().

## ◆ internal_to_local_string_malloc()

char * internal_to_local_string_malloc | ( | const char * | text | ) |

Referenced by client_start_server(), fc_fopen(), fc_opendir(), fc_remove(), fc_stat(), and make_dir().

## ◆ local_to_internal_string_buffer()

char * local_to_internal_string_buffer | ( | const char * | text,
|  | char * | buf,
|  | size_t | bufsz
| ) |  |

Referenced by big_int_to_text(), and fc_strerror().

## ◆ local_to_internal_string_malloc()

char * local_to_internal_string_malloc | ( | const char * | text | ) |

Referenced by get_option_malloc(), and server_sniff_all_input().