]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Bump the version number, bump the copyright, and update the FAQ.
[pr0n] / perl / Sesse / pr0n / Common.pm
index 2ca54cfa7dedcc19a2b65b15baf37c9689599c57..d0bafe648af346c7def363b87ce0f92ae2c0dfb9 100644 (file)
@@ -33,7 +33,7 @@ BEGIN {
                require Sesse::pr0n::Config_local;
        };
 
-       $VERSION     = "v2.12";
+       $VERSION     = "v2.20";
        @ISA         = qw(Exporter);
        @EXPORT      = qw(&error &dberror);
        %EXPORT_TAGS = qw();
@@ -554,6 +554,20 @@ sub add_new_event {
        return ();
 }
 
+sub guess_charset {
+       my $text = shift;
+       my $decoded;
+
+       eval {
+               $decoded = Encode::decode("utf-8", $text, Encode::FB_CROAK);
+       };
+       if ($@) {
+               $decoded = Encode::decode("iso8859-1", $text);
+       }
+
+       return $decoded;
+}
+
 1;