fix incorrect draw utf-8 text in 8-bit locale

This commit is contained in:
Ilia Maslakov 2009-04-17 06:17:37 +00:00
parent 42eba5c18c
commit 8767909493
2 changed files with 9 additions and 4 deletions

View File

@ -434,10 +434,10 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
default: default:
if ( utf8_display ) { if ( utf8_display ) {
if ( !edit->utf8 ) { if ( !edit->utf8 ) {
//c = convert_from_utf_to_current_c (c);
} }
} else { } else {
if ( edit->utf8 ) { if ( edit->utf8 ) {
c = convert_from_utf_to_current_c (c);
//c = convert_to_utf (c); //c = convert_to_utf (c);
} else { } else {
c = convert_to_display_c (c); c = convert_to_display_c (c);

View File

@ -284,14 +284,19 @@ convert_from_utf_to_current (const char *str)
unsigned char unsigned char
convert_from_utf_to_current_c (const int input_char) convert_from_utf_to_current_c (const int input_char)
{ {
unsigned char str[2]; unsigned char str[6 + 1];
unsigned char ch = '.'; unsigned char ch = '.';
char *cp_to = NULL; char *cp_to = NULL;
GIConv conv; GIConv conv;
GString *translated_data; GString *translated_data;
int res = 0;
str[0] = input_char; res = g_unichar_to_utf8 (input_char, str);
str[1] = '\0'; if ( res == 0 ) {
return ch;
}
str[6] = '\0';
translated_data = g_string_new (""); translated_data = g_string_new ("");
cp_to = g_strdup ( get_codepage_id ( display_codepage ) ); cp_to = g_strdup ( get_codepage_id ( display_codepage ) );