Help for this page

Select Code to Download


  1. or download this
    $string =~ s/([^a-zA-Z0-9])/'&#'.unpack('U0U*',$1).';'/eg;
    
  2. or download this
    use HTML::Entites qw( encode_entities );
    $string = encode_entities($string);
    
  3. or download this
    use Encode qw( encode );
    $string = encode('US-ASCII', $string, Encode::FB_HTMLCREF);
    
  4. or download this
    use Encode qw( from_to );
    
    ...
      from_to($string, 'UTF-8', 'US-ASCII', Encode::FB_HTMLCREF);
      return($string);
    }