Skip to content

Character set support

yuki-kimoto edited this page Feb 14, 2011 · 3 revisions

Character Set Support

Generally, it is good that you always use UTF-8 as character set, but you can change character set by Mojolicious::Plugin::Charset.

plugin charset => {charset => 'Shift-JIS'};

String in request parameter is converted from specified character set to Perl internal string.

#  String in request parameter
Shift-JIS -> "Perl internal string"

In HTTP responce, Content-Type header contains specified character set.

Content-Type: text/html; charset=Shift-JIS

You remember to write "http-equiv" in HTML file and save it as specified character set

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift-JIS" />
    <title>タイトル</title>
  </head>
  <body>
    コンテンツ
  </body>
</html>
Clone this wiki locally