Upgrade to Encode 2.00.
[p5sagit/p5-mst-13.2.git] / ext / Encode / Encode.pm
index 043337b..62be76e 100644 (file)
@@ -1,9 +1,9 @@
 #
-# $Id: Encode.pm,v 1.98 2003/08/20 11:16:34 dankogai Exp dankogai $
+# $Id: Encode.pm,v 2.0 2004/05/16 20:55:15 dankogai Exp $
 #
 package Encode;
 use strict;
-our $VERSION = do { my @r = (q$Revision: 1.9801 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 2.0 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
 sub DEBUG () { 0 }
 use XSLoader ();
 XSLoader::load(__PACKAGE__, $VERSION);
@@ -195,11 +195,15 @@ sub encode_utf8($)
     return $str;
 }
 
-sub decode_utf8($)
+sub decode_utf8($;$)
 {
-    my ($str) = @_;
-    return undef unless utf8::decode($str);
-    return $str;
+    my ($str, $check) = @_;
+    if ($check){
+       return decode("utf8", $str, $check);
+    }else{
+       return undef unless utf8::decode($str);
+       return $str;
+    }
 }
 
 predefine_encodings(1);
@@ -739,7 +743,7 @@ implementation.  As such, they are efficient but may change.
 If CHECK is true, also checks the data in STRING for being well-formed
 UTF-8.  Returns true if successful, false otherwise.
 
-As of perl 5.8.1, L<utf8> also has utf8::is_utif8().
+As of perl 5.8.1, L<utf8> also has utf8::is_utf8().
 
 =item _utf8_on(STRING)