Ticket #343 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

git master: --enable-charset should automatically detect user's charset

Reported by: slyfox Owned by: angel_il
Priority: major Milestone: 4.7.0-pre1
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: andrew_b slavazanko

Description

After recently merged utf-8 branch into master we got interesting (rather old) misfeature:
Encoding for output/view/edit is set to 'Other 8 bit' by default.
It is not true for most of modern distros, UTF-8 is almost everywhere nowadays.

When user tries to use git master he stucks with ant awful problem:
editor shows him dots only and user has to:

  • switch display bits to UTF-8 (in F9 -> Dispaly bits)
  • switch encoding via 'Ctrl+T' and set UTF-8 manually

My proposition:

  • Display bits should not be choosable in menu:

they should be detected via LC_CTYPE (nl_langinfo(CODESET))

  • default encoding in editor should be equal to autodetected display bits (unless other is choosen explicitely via 'Ctrl+T')

Change History

comment:1 Changed 7 years ago by slyfox

  • Summary changed from git master: enable charset should automatically detect user's charset to git master: --enable-charset should automatically detect user's charset

comment:2 Changed 7 years ago by slavazanko

  • Version changed from 4.6.2 to master

comment:3 Changed 7 years ago by angel_il

  • Keywords review added

branch: 343_check_codeset (parent: master)
changeset: f3a3a4f3a89eba3e544dc22828431bba36c07870

comment:4 Changed 7 years ago by angel_il

  • Priority changed from critical to major
  • Type changed from defect to enhancement

comment:5 Changed 7 years ago by angel_il

  • Owner set to angel_il
  • Status changed from new to accepted

comment:6 Changed 7 years ago by angel_il

  • Status changed from accepted to assigned

comment:7 Changed 7 years ago by angel_il

branch: 343_autocheck_codeset (parent:master)
changeset: e25d0744f9b4c8808de612115e472aa3fbeb72fc

prev branch has been removed

comment:8 Changed 7 years ago by iNode

Yes, it work.

But why need ask user defaults on first start of mc?
(Yes. mv ~/.mc ~/.mc.bak; mc and it did happend).

I propose setup default vaules without user interaction.

And also cp1251 don't work with this test

#!/bin/sh

rm -f *.tst

#echo "проверка" | iconv -f utf-8 -t cp1251 | enca
echo "проверка" | iconv -f utf-8 -t cp1251 > cp1251file.tst

cat<<DESCRIPTION
=== test #343 ===
Try to edit file cp1251file.tst
when you select charset CP1251 (C-t 5)
you should see text "проверка"

(press enter to close test description)
DESCRIPTION

read void

and the same with koi8-r (and maybe any other).

Did you broke editor charset select or that branch should be rebased?

comment:9 Changed 7 years ago by angel_il

  • Keywords review removed

comment:10 Changed 7 years ago by Hubbitus

  • Cc pahan@… added

comment:11 Changed 7 years ago by angel_il

  • Milestone changed from 4.7 to 4.7.0-pre1

comment:12 Changed 7 years ago by angel_il

  • Keywords review added

rebased again
branch: 343_autocheck_codeset
changeset: 31b8e949cd47d7b29d3cc7d05905c244c27fb9e3

comment:13 Changed 7 years ago by angel_il

changeset: 23e907be8128b98d232099d2c48cf1f7a2dd86ed (forced update)

comment:14 Changed 7 years ago by slavazanko

  • Keywords vote-slavazanko added

All work fine. Code looks good. Three test cases passed:

1.
$ sudo su - test_user
$ rm -fR ~/.mc
$ /path/to/tested/mc
2.
$ sudo su - test_user
$ sed -i 's/UTF\-8/8859-1' ~/.mc/ini
$ /path/to/tested/mc
3. Runing mc with normal config

my vote here.

comment:15 Changed 7 years ago by iNode

% git branch | grep '*'
* 343_autocheck_codeset
%  git log HEAD~1..HEAD | grep commit
commit 23e907be8128b98d232099d2c48cf1f7a2dd86ed
% mc -V | grep GNU
GNU Midnight Commander 4.6.99.2-95-g23e907b

Test case 1:

% rm -rf ~/.mc
% mc 
# [fix it]
# go to test file described in my previous post
# open it 
# Select Windows 1251 [C-t 5]
# no text here
# [F10][F10]
% grep UTF ~/.mc/ini  
display_codepage=UTF-8

So testcase failed.
1) There is no dialog should need for default setup without config.
2) Editor works incorrect (if I select Options->Display Bits manually all works properly)
3) See test case 2

Test case 2:
Run it again.
Dialog window - again. And again [Fix it].
Open test file, [C-t 5], and yeah it's ok.
[F10][F10]

% grep UTF ~/.mc/ini
display_codepage=UTF-8

But every mc start I see that Dialog.

I tested invalid branch or it's work fully invalid?

comment:16 Changed 7 years ago by iNode

  • Keywords vote-iNode added

Yes, now that branch work properly.

comment:17 Changed 7 years ago by slavazanko

  • Keywords approved added; review removed

comment:18 Changed 7 years ago by angel_il

  • Keywords commited-master added; vote-slavazanko vote-iNode approved removed

comment:19 Changed 7 years ago by angel_il

  • Status changed from assigned to testing
  • Resolution set to fixed

comment:20 Changed 7 years ago by angel_il

  • Status changed from testing to closed

comment:21 Changed 7 years ago by andrew_b

  • Status changed from closed to reopened
  • Keywords commited-master removed
  • Resolution fixed deleted
  • severity set to ---
  • Type changed from enhancement to defect

If mc is run as viewer or editor the codeset is not checked.

comment:22 Changed 7 years ago by angel_il

  • Keywords review added
  • severity changed from --- to review

Branch: 343_fix_mcedit_autochoice_codeset (parent: master)
changeset: cb9171d2ed99061478bd8451d287f33f04def30b

comment:23 Changed 7 years ago by angel_il

comment:24 Changed 7 years ago by angel_il

  • Keywords review removed

comment:25 Changed 7 years ago by andrew_b

  • Votes for changeset set to andrew_b

comment:26 Changed 7 years ago by slavazanko

  • Votes for changeset changed from andrew_b to andrew_b slavazanko
  • severity changed from on review to approved

comment:27 Changed 7 years ago by angel_il

  • Votes for changeset changed from andrew_b slavazanko to commided-master
  • severity changed from approved to merged

comment:28 Changed 7 years ago by angel_il

  • Status changed from reopened to closed
  • Resolution set to fixed

comment:29 Changed 7 years ago by angel_il

  • Votes for changeset changed from commided-master to commited-master

comment:30 Changed 7 years ago by styx

  • Cc pahan@… removed
  • Votes for changeset changed from commited-master to andrew_b slavazanko
Note: See TracTickets for help on using tickets.