Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    
    my $text = "\xC9ric";
    say looks_like_cp1252($text) ?1:0;   # 0
    
  2. or download this
    my $txt;
    if (is_valid_utf8($text)) {
    ...
    } else {
       $txt = decode('Windows-1252', $bytes);
    }
    
  3. or download this
    my $bytes = '...';
    my $txt;
    ...
    }) {
       $txt = decode('Windows-1252', $bytes);
    }