Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use utf8;
- # convert unicode to Decimal NCR format
- sub convertUnicodeToDecimalNCR {
- my ($self, $str) = @_;
- # important
- utf8::decode($str);
- my $ret_str = "";
- while ($str =~ /(.)/g) {
- my $c = $1;
- my $b = ord($c);
- if ($b > ord('z') && $b ne 123 && $b ne 125 && $b ne 126) {
- $ret_str .= "&#".$b.";";
- } else {
- $ret_str .= $c;
- }
- }
- # $str =~ s/./"&#".ord($&).";" if /eg;
- return $ret_str;
- }
Add Comment
Please, Sign In to add comment