How to encode cyrillic characters for URL and then decode them?

前端 未结 3 781
情深已故
情深已故 2021-01-18 17:17

I have a form on one page:

One of the input fi

3条回答
  •  悲&欢浪女
    2021-01-18 17:55

    A solution that preserves the + and any other character in the original string:

    my $s = '%41F%2F%424+%41F%41E%414%416%410%420%41A%410+%418%417+%421%412%418%41D';
    $s =~ s/%([[:xdigit:]]+)/chr(hex($1))/eg;
    print $s;
    

    Result:

    П/Ф+ПОДЖАРКА+ИЗ+СВИН
    

提交回复
热议问题