kosta5
kosta5

Reputation: 1138

Perl CGI.pm encoding - wrong encoding for "ě"

I have a simple web page that uses CGI.pm This is what I do:

  1. when I call any perl CGI.pm function and use czech character "ě" for value of a textfield, label of radio_group or anything else I get �› insetad of "ě"

  2. this is extremly weird - since the whole page is utf8 (<meta name="charset" content="utf-8"/> ). Especially since this works

      print '<textfield value="ěěěě" >';
    
  3. therefore I am positive - it has to be CGI.pm causing the problem... I tried to put

      use utf8;
      utf8::decode($textfield_value);
    

    at the beginning of my scirpt and it fixed the CGI.pm problem but made all other characters in the script (those that are regulary printed) look funny..

Any ideas???

Upvotes: 2

Views: 422

Answers (2)

Aidan Medcalf
Aidan Medcalf

Reputation: 135

Have you tried replacing the ě's with their octal or hex escapes? Unfortunately, there doesn't seem to be an HTML code for the character.

Upvotes: 0

mob
mob

Reputation: 118605

Set the accept-charset attribute in your form fields to UTF-8?

<form action="/..." accept-charset="UTF-8">

This might not be sufficient to solve your problem, but it is often necessary to force the client browser to utf8-encode the form data that gets sent to the server.

Upvotes: 1

Related Questions