mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
fix incorrect draw utf-8 text in 8-bit locale
This commit is contained in:
parent
42eba5c18c
commit
8767909493
@ -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);
|
||||||
|
@ -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 ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user