Help for this page

Select Code to Download


  1. or download this
    use HTML::Entities;
    my $text = chr(256);
    print encode_entities($text);
    
  2. or download this
    use HTML::Entities;
    use Text::Iconv;
    ...
    $text = $conv->convert($text);
    encode_entities($text);
    print "$text\n";
    
  3. or download this
    $text =~ s/([^[:print:]])([^[:print:]])/
              '&#'.
              ((((ord($1) & 0x7F) << 6) + (ord($2) & 0x7F)) & 0x7FFF).
              ';'/eg;