Mail Archives: cygwin/2006/12/08/15:23:41
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 -