This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pod: Suggest to use strict UTF-8 encoding when dealing with external data
[perl5.git] / pod / perluniintro.pod
index 992f6b9..5a865c9 100644 (file)
@@ -752,12 +752,12 @@ How Do I Detect Data That's Not Valid In a Particular Encoding?
 Use the C<Encode> package to try converting it.
 For example,
 
-    use Encode 'decode_utf8';
+    use Encode 'decode';
 
-    if (eval { decode_utf8($string, Encode::FB_CROAK); 1 }) {
-        # $string is valid utf8
+    if (eval { decode('UTF-8', $string, Encode::FB_CROAK); 1 }) {
+        # $string is valid UTF-8
     } else {
-        # $string is not valid utf8
+        # $string is not valid UTF-8
     }
 
 Or use C<unpack> to try decoding it: