+2009-09-24 ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
+
+ * lib/Keitairc/Config.pm, lib/Keitairc/View.pm,
+ lib/templates/{default,ipod-sjis}/*:
+ web_charset \e$B$r;XDj$7$?$H$-$K$A$c$s$H;XDj$I$*$j$K$J$k$h$&$K\e(B
+ \e$B%G%#%U%)%k%H$N\e(Bcharset\e$B%O%s%I%j%s%0%k!<%A%s!"%F%s%W%l!<%H$N\e(B
+ \e$B%(%s%3!<%G%#%s%0$NJQ49=hM}$rDI2C!#\e(Bmeta \e$B%X%C%@$N\e(Bcharset\e$B$r\e(B
+ \e$B30It$+$i%;%C%H$G$-$k$h$&$K%F%s%W%l!<%H$r99?7\e(B(ticket: #18509)
+
2009-07-16 ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
* lib/templates/ipod-sjis/index.html: add irc command input
# -*- mode: perl; coding: utf-8 -*-
# Keitairc::Config
-# $Id: Config.pm,v 1.33 2009-09-24 14:18:23 morimoto Exp $
+# $Id: Config.pm,v 1.34 2009-09-24 14:48:21 ishikawa Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/Config.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
package Keitairc::Config;
use AppConfig qw(:argcount);
use Cwd;
+use Encode::MIME::Name;
use strict;
use warnings;
our @ISA = qw(AppConfig);
Keitairc::Log::log("$file does not exist");
}
+################################################################
+sub content_charset{
+ my $me = shift;
+ Encode::MIME::Name::get_mime_name(Encode::resolve_alias($me->web_charset()));
+}
+
1;
# -*- mode: perl; coding: utf-8 -*-
# Keitairc::View
-# $Id: View.pm,v 1.25 2009-07-15 13:47:01 ishikawa Exp $
+# $Id: View.pm,v 1.26 2009-09-24 14:48:21 ishikawa Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/View.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
$p->{version} = $me->{Config}->version();
$p->{common_header} = $me->{Config}->common_header();
$p->{extra_header} = $me->{Config}->extra_header();
+ $p->{content_charset} = $me->{Config}->content_charset();
if($me->{ClientInfo}->is_mobile){
$p->{fontsize} = $me->{Config}->mobile_fontsize();
$arch = 'ipod-sjis';
}
+ # Note: ishikawa
+ # 現状、varsの中は既にencodeされた文字列が入ってきているはずだけど
+ # 内部コードのままで、最後の output を encode するのが本来はいい
+ # のではないかと思う。
+ # が、今いじるとあちこち影響でそうなので 2.0 出てから直す。
if (my $filename = $me->template_path("$arch/$template")) {
my $t = new HTML::Template(
filename => $filename,
die_on_bad_params => 0,
+ filter => sub {
+ my $text_ref = shift;
+ Encode::from_to($$text_ref, 'shift_jis', $me->{Config}->web_charset());
+ },
cache => 1);
$t->param($p);
# not found
my $response = HTTP::Response->new(404);
- $response->push_header('Content-type', 'text/html; charset=Shift_JIS');
+ $response->push_header('Content-type', 'text/html; charset=' . $me->{Config}->content_charset());
$response->content($me->template('404.html', { action => $file }));
return $response;
}
my $template = shift;
my $vars = shift || {};
my $response = HTTP::Response->new(200);
- $vars->{content_type} |= 'text/html; charset=Shift_JIS';
+ $vars->{content_type} |= 'text/html; charset=' . $me->{Config}->content_charset();
$response->push_header('Content-type', $vars->{content_type});
$response->content($me->template($template, $vars));
$response;
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: \92n\90}\95\\8e¦</title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: <!-- tmpl_var channel_compact --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: <!-- tmpl_var channel_compact --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: <!-- tmpl_var channel_compact --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: icc\95\\8e¦</title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: icc\95\\8e¦</title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: \83\8d\83O\83A\83E\83g</title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: mail <!-- tmpl_var mail --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: phone <!-- tmpl_var phone --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: postme</title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: <!-- tmpl_var channel_compact --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: URL <!-- tmpl_var url --></title>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<!-- tmpl_var extra_header -->
<title><!-- tmpl_var title -->: URL <!-- tmpl_var url --></title>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ <meta http-equiv="Content-Type" content="text/html; charset=<!-- tmpl_var content_charset -->" />
<!-- tmpl_var common_header -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
<style type="text/css" media="screen">