On Mon, Oct 4, 2010 at 5:33 PM, Michael Peters <mpet...@plusthree.com> wrote: > On 10/04/2010 05:13 PM, ĵohn sayļør wrote: > >> i think you have to do this programmatically by examining the characters >> in the file. there may be libraries to do this already somewhere, but i >> have exerted no effort to find them. > > It's not 100% (it can't be when you don't know the encoding) but you can > use something like Encode::Guess or Text::GuessEncoding.
Still not a 100% solution, but you can also check the BOM: http://search.cpan.org/~mattlaw/File-BOM-0.14/lib/File/BOM.pm If it's there, use it... else, move on to guessing, and fall back to utf8 (or ascii, and barf all over if something is out of range). -- Josh I. ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################