Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Converting everything (MySql, perl, CGI, website) to UTF-8

by davebaker (Pilgrim)
on Oct 13, 2020 at 01:09 UTC ( [id://11122755]=note: print w/replies, xml ) Need Help??


in reply to Converting everything (MySql, perl, CGI, website) to UTF-8

It's also helpful to include accept-charset="utf-8" inside the form tag in any forms on any HTML pages you've created. That way, if your server were to be configured to send "Content-Type: text/html; charset=ISO-8859-1" in the httpd response header of the HTML page containing the form (accidentally, or for whatever other reason, such as its being the default for Apache), the text entered by the user into the form nevertheless would be encoded by the user's browser as UTF-8 when it's submitted. Without an accept-charset attribute inside the form tag, the browser in that scenario would encode the text using whatever encoding is specified in the httpd response header sent by Apache or other web server that serves up the HTML page.

Also, if the HTML page with the form has a meta tag that specifies a character set other than UTF-8, such as <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> or <meta charset=ISO-8859-1>, having accept-charset="utf-8" inside the form tag would cause the browser to use UTF-8 encoding for the submitted text. (It's true that most browsers ignore such meta tags when a web server already has sent charset=UTF-8 in the header, but a copy of the web page might have been saved to the user's computer and thereafter used to submit text in a form, in which case there would be no headers from a server to prevent the meta tags from controlling the page's character set and corresponding encoding of submitted text.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-28 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found