mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
fix: <no translation> behaviour
Signed-off-by: Ilia Maslakov <il.smind@google.com>
This commit is contained in:
parent
459ef0665f
commit
a799ef4329
@ -208,28 +208,27 @@ void
|
|||||||
mcview_select_encoding (mcview_t * view)
|
mcview_select_encoding (mcview_t * view)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
const char *enc = NULL;
|
const char *cp_id = NULL;
|
||||||
|
if (do_select_codepage ()) {
|
||||||
|
cp_id = get_codepage_id (source_codepage >= 0 ?
|
||||||
|
source_codepage : display_codepage);
|
||||||
|
|
||||||
if (!do_select_codepage ())
|
if (cp_id != NULL) {
|
||||||
return;
|
GIConv conv;
|
||||||
|
conv = str_crt_conv_from (cp_id);
|
||||||
enc = get_codepage_id (source_codepage);
|
if (conv != INVALID_CONV) {
|
||||||
if (enc != NULL) {
|
if (view->converter != str_cnv_from_term)
|
||||||
GIConv conv;
|
str_close_conv (view->converter);
|
||||||
|
view->converter = conv;
|
||||||
conv = str_crt_conv_from (enc);
|
}
|
||||||
if (conv != INVALID_CONV) {
|
|
||||||
if (view->converter != str_cnv_from_term)
|
|
||||||
str_close_conv (view->converter);
|
|
||||||
view->converter = conv;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (enc != NULL && str_isutf8 (enc) != 0)
|
|
||||||
view->utf8 = TRUE;
|
|
||||||
else
|
|
||||||
view->utf8 = FALSE;
|
|
||||||
|
|
||||||
|
if (cp_id != NULL)
|
||||||
|
view->utf8 = (gboolean) str_isutf8 (cp_id);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -279,7 +279,7 @@ mcview_load (mcview_t * view, const char *command, const char *file, int start_l
|
|||||||
char *canon_fname;
|
char *canon_fname;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
const char *cp_id;
|
const char *cp_id = NULL;
|
||||||
#endif
|
#endif
|
||||||
gboolean retval = FALSE;
|
gboolean retval = FALSE;
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
@ -363,17 +363,22 @@ mcview_load (mcview_t * view, const char *command, const char *file, int start_l
|
|||||||
view->dpy_text_column = 0;
|
view->dpy_text_column = 0;
|
||||||
|
|
||||||
view->converter = str_cnv_from_term;
|
view->converter = str_cnv_from_term;
|
||||||
/* try detect encoding from path */
|
#ifdef HAVE_CHARSET
|
||||||
if (view->filename != NULL) {
|
cp_id = get_codepage_id (source_codepage >= 0 ?
|
||||||
canon_fname = vfs_canon (view->filename);
|
source_codepage : display_codepage);
|
||||||
enc = vfs_get_encoding (canon_fname);
|
|
||||||
if (enc != NULL) {
|
if (cp_id != NULL) {
|
||||||
view->converter = str_crt_conv_from (enc);
|
GIConv conv;
|
||||||
if (view->converter == INVALID_CONV)
|
conv = str_crt_conv_from (cp_id);
|
||||||
view->converter = str_cnv_from_term;
|
if (conv != INVALID_CONV) {
|
||||||
|
if (view->converter != str_cnv_from_term)
|
||||||
|
str_close_conv (view->converter);
|
||||||
|
view->converter = conv;
|
||||||
}
|
}
|
||||||
g_free (canon_fname);
|
|
||||||
}
|
}
|
||||||
|
if (cp_id != NULL)
|
||||||
|
view->utf8 = (gboolean) str_isutf8 (cp_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
mcview_compute_areas (view);
|
mcview_compute_areas (view);
|
||||||
assert (view->bytes_per_line != 0);
|
assert (view->bytes_per_line != 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user