3 * \brief Header: Text conversion from one charset to another
11 #define UNKNCHAR '\001'
13 extern int n_codepages
;
15 extern unsigned char conv_displ
[256];
16 extern unsigned char conv_input
[256];
18 struct codepage_desc
{
23 extern const char *cp_display
;
24 extern const char *cp_source
;
25 extern struct codepage_desc
*codepages
;
27 const char *get_codepage_id (const int n
);
28 int get_codepage_index (const char *id
);
29 int load_codepages_list (void);
30 void free_codepages_list (void);
31 const char *init_translation_table (int cpsource
, int cpdisplay
);
32 void convert_to_display (char *str
);
33 void convert_from_input (char *str
);
34 void convert_string (unsigned char *str
);
36 * Converter from utf to selected codepage
38 * return char in needle codepage (by global int source_codepage)
40 unsigned char convert_from_utf_to_current (const char *str
);
42 * Converter from utf to selected codepage
43 * param input_char, gunichar
44 * return char in needle codepage (by global int source_codepage)
46 unsigned char convert_from_utf_to_current_c (const int input_char
, GIConv conv
);
48 * Converter from selected codepage 8-bit
49 * param char input_char, GIConv converter
52 int convert_from_8bit_to_utf_c (const char input_char
, GIConv conv
);
54 * Converter from display codepage 8-bit to utf-8
55 * param char input_char, GIConv converter
58 int convert_from_8bit_to_utf_c2 (const char input_char
);
60 GString
*str_convert_to_input (char *str
);
61 GString
*str_nconvert_to_input (char *str
, int len
);
63 GString
*str_convert_to_display (char *str
);
64 GString
*str_nconvert_to_display (char *str
, int len
);
66 /* Convert single characters */
68 convert_to_display_c (int c
)
70 if (c
< 0 || c
>= 256)
76 convert_from_input_c (int c
)
78 if (c
< 0 || c
>= 256)
83 #else /* !HAVE_CHARSET */
85 #define convert_to_display_c(c) (c)
86 #define convert_from_input_c(c) (c)
87 #define convert_to_display(str) do {} while (0)
88 #define convert_from_input(str) do {} while (0)
90 #endif /* HAVE_CHARSET */