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 = é

Replies are listed 'Best First'.
Re^6: Yet another Encoding issue...
by Bod (Parson) on Jun 01, 2024 at 22:06 UTC

    I'm using UTF-8

    Content-type: text/html; charset=UTF-8 <html> <meta charset="UTF-8">