Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 155974 - mc uses strange 'Other 8 bit' in the charset conversion
Summary: mc uses strange 'Other 8 bit' in the charset conversion
Alias: None
Product: Fedora
Classification: Fedora
Component: mc
Version: 3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact:
Depends On: 154516
TreeView+ depends on / blocked
Reported: 2005-04-26 12:26 UTC by Andy Shevchenko
Modified: 2013-07-02 23:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-18 10:39:46 UTC
Type: ---

Attachments (Terms of Use)
Patch for using current charmap instead of 'Other 8 bit' (4.21 KB, patch)
2005-04-26 12:26 UTC, Andy Shevchenko
no flags Details | Diff
New version of patch (4.37 KB, patch)
2005-04-27 09:59 UTC, Andy Shevchenko
no flags Details | Diff

Description Andy Shevchenko 2005-04-26 12:26:57 UTC
Description of problem:
mc uses strange item 'Other 8 bit' in charset chooser. I resolved the problem by 
changing that item to native current charmap (got by nl_langinfo(CODESET)).
In addition we do not need to choose charmap after first start of mc.

This bug is correlated with Andrew's patch from bug #154516.

Version-Release number of selected component (if applicable):
Last official FC3 update (and may be current)

Comment 1 Andy Shevchenko 2005-04-26 12:26:57 UTC
Created attachment 113664 [details]
Patch for using current charmap instead of 'Other 8 bit'

Comment 2 Jindrich Novy 2005-04-27 05:05:03 UTC
Hello Andy,

+static const char *
+get_current_charmap (void)
+    int init = -1;
+    static char *charmap = NULL;
+    if (init == -1) {
+       char *lc_ctype = setlocale (LC_CTYPE, "");
+       charmap = nl_langinfo (CODESET);
+       setlocale (LC_CTYPE, lc_ctype);
+       init = 0;
+    }
+    return charmap;

Doesn't the init variable miss the static storage class? The condition will be
executed every time when get_current_charmap() is called what is likely not
intended. Also #include <langinfo.h> seems to be missing.

Comment 3 Andy Shevchenko 2005-04-27 09:44:58 UTC
Hi, Jindrich.

1. Yes, I missed
2. Also, yes.

Thanks for reviewing code.

Comment 4 Andy Shevchenko 2005-04-27 09:46:19 UTC
2. Sorry, I am wrong. The langinfo.h already added.

Comment 5 Andy Shevchenko 2005-04-27 09:59:48 UTC
Created attachment 113710 [details]
New version of patch

Fix non-static class of init variable.
Also fix potential segfault in the strcasecmp().

Comment 6 Jindrich Novy 2005-04-28 08:02:20 UTC
Andy, the patch looks much better now but the only thing I'm afraid of is broken
translations of the "Current charmap" instead of "Other 8 bit". Maybe it's a
good thing if you send this patch to upstream so that people will take care
about translating the message when the patch is commmitted there.

Also it's not very usual that you put credits directly to the source code. If
you don't have any objections I credit authors of the patches in the spec file
instead of the source directly as I did in Andrew's case for instance.

Comment 7 Andy Shevchenko 2005-05-04 08:13:14 UTC
Ok, I try to some change patch (instead of -> with) and send to upstream it.
Yes, I agree with you. This patch injects minor function and no needs credit.

Comment 8 Jindrich Novy 2005-05-04 10:38:11 UTC
Andy, thanks for the patch anyway.

I'll close this bug UPSTREAM whenever I see mail from you on mc-devel.

Comment 9 Andy Shevchenko 2005-05-18 08:44:08 UTC
Hi, Jindrich!

I've put message to mc-devel@ list today.
You can close bug.

P.S> However, I should like to make this patch more convenient.

Comment 10 Jindrich Novy 2005-05-18 10:39:46 UTC
Hello Andy!

Thanks! I'll try to discuss it on upstream list when needed and keep track of it.

Note You need to log in before you can comment on or make changes to this bug.