delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/08/15:23:41

X-Spam-Check-By: sourceware.org
Message-ID: <4579BC2E.2020200@mail.ru>
Date: Fri, 08 Dec 2006 22:25:34 +0300
From: Ruslan Fedyarov <fedyarov AT mail DOT ru>
User-Agent: Mozilla Thunderbird 0.9 (X11/20041113)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Midnight Commander problem
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi,

I've experienced problem with %view{ascii} mode in Midnight Commander's
bindings. I use enca-like encoding autodetector to tell w3m or another
program what the correct input encoding is:

View=%view{ascii} w3m -dump -I `enca`'

Everything works fine in Linux, but not in Cygwin environment.
In %view{ascii} mode Russian characters are shown different from normal
F3 mode, capital letters are missing and lower case letters are somehow
highlighted although I view usual black & white text files. I tried to
experiment with F8, %view{unform} and output to another encoding, but
nothing helped - either I get abracadabra or again I can't see Russian
capital letters.

The autodetector "enca.c" follows:

#include <stdio.h>
#include <stdlib.h>

char prebuf[1000];

int main(int argc, char *argv[])
{
int i, c, lower, higher;

if (argc>1) freopen(argv[1], "rb", stdin);

i=fread(prebuf, 1, 1000, stdin);
for (lower=higher=0; i>=0; i--)
         {
         c=prebuf[i];
         if (c<0) c+=256;
         if (c>=0x80 && c<0xC0 && c!=0xA8 && c!=0xB8)
                 {
                 printf("cp866\n");
                 exit(0);
                 }
         if (c>=0xE0) higher++;
         else if (c>=0xC0) lower++;
         }
printf((higher>=lower)? "cp1251\n": "koi8-r\n");
return 0;
}

Thank you,
Ruslan


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019