Automatic codepage detection

Here you can report bugs found in Far Manager.
Post Reply
taffer
Posts: 3
Joined: Fri 24 Aug, 2012 19:04

Automatic codepage detection

Post by taffer » Fri 24 Aug, 2012 19:39

Far Manager 3.0 build 2789
When I open a non-Unicode text file for editing, the default code page is always 1252 (ANSI - Latin I), even though in Windows regional settings a Central-European language is set for non-Unicode texts. I think Far uses these regional settings after all because when I press F8, 1250 (ANSI - Central Europe) and 852 (OEM - Latin II) are toggled.

I would prefer if auto detection used the default ANSI encoding when other code page cannot be detected because when I forget to check the code page I might accidentally kill every accents in the text when I re-save the file, which is very frustrating. :o

Far 1.x and 2.x versions worked well in this aspect.

blabulabul
Posts: 8
Joined: Mon 10 Sep, 2012 14:37

Re: Automatic codepage detection

Post by blabulabul » Mon 10 Sep, 2012 14:43

Hi, I found this solution: http://www.farmanager.com/svn/trunk/uni ... ngelog_eng , Mantis#0001774.

You must enable autodetection of CP and set parameter NoAutoDetectCP to "-1" (f.e.). This is example of farconfig to import:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<farconfig>
    <generalconfig>
<!-- 
   A strNoAutoDetectCP text parameter is added to configuration, it can contain codepages to be excluded 
   from UCD autodetection, separated with commas.

   the listed codepages are excluded from automatic detection with nsUniversalDetectorEx.
   unicode pages autodetection does not depend on it, therefore UTF-8 is detected even if
   65001 is listed here. If UniversalDetector returns a page from this list, it is replaced with
   the default ANSI or OEM, depending on settings.

   if strNoAutoDetectCP is:
     "" - no UCD autodetection filtration (this is by default like now)
       "-1" - only ACP, OEMCP and favorites are passed if Ctrl-H is on (otherwise there is no filtering)
     "cp1,cp2,..." - the listed ones are rejected
  
   an example: "1250,1252,1253,1255,855,10005,28592,28595,28597,28598,38598,65001" - these
           codepages will be excluded from detection
-->
        <setting key="CodePages" name="NoAutoDetectCP" type="text" value="-1" />
    </generalconfig>
</farconfig>
Last edited by HaRT on Mon 10 Sep, 2012 15:11, edited 1 time in total.
Reason: Fixed code formatting

Post Reply

Return to “Bug Reports”