in reply to How to encode special characters like ä,ß,é,... in html unicode codes like ä or ä
The principle is this:use encoding 'utf8'; use HTML::Entities 'decode_entities'; my $string = 'Hello ä/ä ... ß,é'; $string =~ s/(.)/ord($1)>160?'&#'.ord($1).';':$1/ge; print "$string\n"; # encoded print decode_entities($string),"\n"; # decoded
use encoding 'utf8'; print '&#' . ord('ä') . ';'; # prints ä
|
|---|