jbrugger has asked for the wisdom of the Perl Monks concerning the following question:
This is not returning anything however.#!/usr/bin/perl -w use strict; use File::BOM qw( :all ); open_bom(FH, "test.txt", 'bytes'); my $encoding = get_encoding_from_filehandle(FH); print $encoding . "\n\n";
For the rest i did not find any other way of dertermining the encoding of a file, anyone knows what is wrong with File::BOM or does anyone have a better solution?use Encode::Guess; my $decoder = guess_encoding($arg->{String}, 'latin1'); if (ref($decoder)) { return 0; } else { return 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to check the encoding of a file
by ysth (Canon) on Apr 10, 2006 at 11:16 UTC | |
|
Re: how to check the encoding of a file
by graff (Chancellor) on Apr 11, 2006 at 02:34 UTC |