Ticket #1838 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

source_codepage autodetect with enca program.

Reported by: ASM Owned by: andrew_b
Priority: major Milestone: 4.7.3
Component: mc-core Version: master
Keywords: enca, codepage, encoding, autodetect, source_codepage Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

Hello.

I wrote stupid patch for autodetect source_codepage. It working then open/view/edit events.

It using enca package (http://gitorious.org/enca, for fedora: https://admin.fedoraproject.org/pkgdb/packages/name/enca)

Use autodetect source_codepage very convenient. Please don't ignore it.

Attachments

enca.patch (6.2 KB) - added by ASM 10 years ago.
Fix, if codepage don't detect, don't warning.
0001-REBASE-CLEANUP-for-merge-with-730ab3937cc3d8d978b5.patch (3.8 KB) - added by slavazanko 9 years ago.
0002-REBASE-CLEANUP-for-merge-with-5307c0bbda0a70b66ccb.patch (1.2 KB) - added by slavazanko 9 years ago.
Please, use one-style source coding
enca.2.patch (8.1 KB) - added by ASM 9 years ago.
Fixed version.

Change History

comment:1 Changed 10 years ago by andrew_b

  • Milestone changed from 4.7.0 to 4.7

Changed 10 years ago by ASM

Fix, if codepage don't detect, don't warning.

comment:2 Changed 9 years ago by osgx

There must be way to disable auto-detection or to manually select codepage if enca fails to do it right.

comment:3 Changed 9 years ago by slavazanko

Yes, right. But this is an enhancement (not a bugfixing or code cleanup). Therefore this ticket not for '4.7.0' milestone. Just await :)

comment:4 Changed 9 years ago by ASM

I tested my patch and made a few notes:

  • Need add on MC menu:
    • Enca on/off
    • Enca language
    • Maybe add default source_codepage encoding (if enca fail)
  • Don't use mc.ext for enca. Is unnecessary. Program 'file' is often mistaken for utf-8 files, view their 'data'. If enca is on, need exec it for all source files. If enca wrong, need set display_codepage(or another).

Another idea?

There must be way to disable auto-detection or to manually select codepage if enca fails to do it right.

Is't work. (F9->Command->Encoding)

---
I'm no good code writer, but I'm working on that. I try rewrite patch.
Sorry my english, but I'm working on that too. :-)

Last edited 8 years ago by slavazanko (previous) (diff)

comment:5 Changed 9 years ago by slavazanko

ASM: is you have own publish git-repo? For example, on http://github.com/ or on
http://repo.or.cz/

This better to develop in your own branch, because in this case you will maintainer of your idea and anybody will send patches to you instread of... :)

comment:6 Changed 9 years ago by ASM

Hello, folks!

I add enca support (autodetect). Need add to ini file new option.
What name give this? How to use?

For example something like:

  • codepage_autodetect= no use enca
  • codepage_autodetect=ru use enca, set language Russian
  • codapage_autodetect=off no use enca

comment:7 Changed 9 years ago by ASM

codepage_autodetect -> autodetect_codeset

comment:8 Changed 9 years ago by ASM

I release it in http://github.com/BASM/mc-basm/tree/ASM/1838_enca.

  • added autodetect parameter,
  • added enca support,
  • added default codepage, if enca fail.

Changed 9 years ago by slavazanko

Please, use one-style source coding

comment:9 Changed 9 years ago by ASM

  • Style code fixed,
  • Bugs fixed.

I think autodetect language done.

comment:10 Changed 9 years ago by ASM

s/language/encoding/

Changed 9 years ago by ASM

Fixed version.

comment:11 Changed 9 years ago by ASM

comment:12 Changed 9 years ago by slavazanko

  • Owner set to slavazanko
  • Status changed from new to accepted
  • Version changed from 4.7.0-pre4 to master
  • severity changed from no branch to on review

Created & rebased branch 1838_add_enca_support

Initial changeset:b5b119ffac2bca5edb30aaec98a32b6fa9bab031

Review, please.

comment:13 Changed 9 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:14 Changed 9 years ago by angel_il

Changeset: 71d58780d127cc8d2426e00b40f8ffc0a4854c9d (forced update)

comment:15 Changed 9 years ago by andrew_b

  • Votes for changeset slavazanko deleted

Code was fixed and documentaion was updated. Please revire again.
changeset:dd93a53afc6ec190a95ef6d83b9a72e9cea5f3e4 -- code
changeset:cc432bd67f4c2edfecd39b60e22f6158d5127005 -- documentation

comment:16 Changed 9 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:17 Changed 9 years ago by andrew_b

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

comment:18 Changed 9 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko andrew_b to commited-master
  • Resolution set to fixed
  • severity changed from approved to merged

comment:19 Changed 9 years ago by slavazanko

  • Status changed from testing to closed

comment:20 Changed 9 years ago by andrew_b

  • Status changed from closed to reopened
  • Votes for changeset committed-master deleted
  • severity changed from merged to on review
  • Type changed from enhancement to defect
  • Milestone changed from 4.7 to 4.7.3
  • Resolution fixed deleted

Charset autodetection is partially broken in recent master (4.7.2-46-g7843203).
In my KOI8-R locale 8-bit the UTF-8 charset is not autodetected as in editor as in viewer. 8-bit locales are autodetected.

To fix this issue, the 1838_codeset_autodetect_fix branch was created. Parent branch is master.
Initial changeset:e053e1d29d79d92de96d0fcdaae1cfd231d6bcd9

comment:21 Changed 9 years ago by andrew_b

  • Status changed from reopened to accepted
  • Owner changed from slavazanko to andrew_b

comment:22 Changed 9 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:23 Changed 9 years ago by angel_il

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

comment:24 Changed 9 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko angel_il to committed-master
  • Resolution set to fixed
  • severity changed from approved to merged

Merged to master.
changeset:12969b49741caed5bf529e062cc47d8edb8802ad

git log --pretty=oneline 6117c5b..12969b4

comment:25 Changed 9 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.