DervishD wrote:
    Hi Tony :)

 * A.J.Mechelynck <[EMAIL PROTECTED]> dixit:
Notice the dash between utf and 8.
   My bad, I typed carelessly. It succeeded on my system because I did
my first test with a file *named* 'utf8'. I've noticed the problem a
moment ago, and it's already fixed.
Hoho... Then maybe you should use file -bi rather than file -i in order to avoid detecting UTF-8 for:

/home/raul/utf-8_to_latin.txt: text/plain; charset=ISO-8859-1

I've done that and more: if system("file -bi " . expand("<amatch>")) =~# "; charset=utf-8$"
    I was too lazy to ellaborate the regex correctly. It is still
unellaborated, but works better.

    Raúl Núñez de Arenas Coronado


"regexp matches with matching case", "; charset=utf-8" at end of string. Redundant with -b but ought to work, unless a text file can have something after the charset, which I haven't seen yet in the experiments I've done.

One thing I just noticed: shell scripts (which are text) get "application/x-shellscript" and no charset, at least on my system; IMHO that's a bug in the "file" program.


Best regards,
Tony.

Reply via email to