http://www.perlmonks.org?node_id=11159748


in reply to Re^4: Yet another Encoding issue...
in thread Yet another Encoding issue...

By the way, depending on what charset you are specifying in your html you may get problems. For example, the little CGI script:
#!/bin/bash echo "Content-Type: text/html" echo "" perl -we 'use Encode; $c = encode("UTF-8", "é"); $dc = decode("UTF-8", + $c); print "\$c = $c \$dc = $dc\n"'
displays as: $c = é $dc = é

But if you fix the encoding like:

#!/bin/bash echo "Content-Type: text/html; charset=UTF-8" echo "" perl -we 'use Encode; $c = encode("UTF-8", "é"); $dc = decode("UTF-8", + $c); print "\$c = $c \$dc = $dc\n"'
it displays as: $c = é $dc = é