From: Ian Jackson Date: Fri, 14 Aug 2009 14:12:07 +0000 (+0100) Subject: set content-type charset and LC_CTYPE to UTF-8 X-Git-Tag: 3.4~194 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=e1104ec9b3f093f6c496cd9763b06b0792b679ff;ds=sidebyside set content-type charset and LC_CTYPE to UTF-8 also add some forgotten files --- diff --git a/yarrg/Commods.pm b/yarrg/Commods.pm index b90e6d7..0f7ebd6 100644 --- a/yarrg/Commods.pm +++ b/yarrg/Commods.pm @@ -41,7 +41,8 @@ BEGIN { &pipethrough_prep &pipethrough_run &pipethrough_run_along &pipethrough_run_finish &pipethrough_run_gzip - &cgipostform &yarrgpostform &cgi_get_caller); + &cgipostform &yarrgpostform &cgi_get_caller + &set_ctype_utf8); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); @@ -356,4 +357,8 @@ sub cgi_get_caller () { return $caller; } +sub set_ctype_utf8 () { + setlocale(LC_CTYPE, "en.UTF-8"); +} + 1; diff --git a/yarrg/CommodsWeb.pm b/yarrg/CommodsWeb.pm index 46b32e6..5f85511 100644 --- a/yarrg/CommodsWeb.pm +++ b/yarrg/CommodsWeb.pm @@ -52,7 +52,8 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(&dbw_connect &ocean_list $sourcebasedir - to_json to_json_protecttags); + &to_json &to_json_protecttags + &set_ctype_utf8); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); diff --git a/yarrg/commod-email-processor b/yarrg/commod-email-processor index 0c16cd1..b395aa8 100755 --- a/yarrg/commod-email-processor +++ b/yarrg/commod-email-processor @@ -39,7 +39,7 @@ BEGIN { use Commods; use CommodsDatabase; -setlocale(LC_CTYPE, "en_GB.UTF-8"); +set_ctype_utf8(); my $parser= new MIME::Parser; our $entity; diff --git a/yarrg/commod-update-receiver b/yarrg/commod-update-receiver index 889913d..f114428 100755 --- a/yarrg/commod-update-receiver +++ b/yarrg/commod-update-receiver @@ -35,7 +35,7 @@ $CGI::POST_MAX= 3*1024*1024; use CGI qw/:standard -private_tempfiles/; -setlocale(LC_CTYPE, "en_GB.UTF-8"); +set_ctype_utf8(); our $now= time; defined $now or die $!; diff --git a/yarrg/web/autohandler b/yarrg/web/autohandler new file mode 100644 index 0000000..ba6c8b9 --- /dev/null +++ b/yarrg/web/autohandler @@ -0,0 +1,7 @@ + +% $m->call_next; +<%init> +use CommodsWeb; +set_ctype_utf8(); +$r->content_type('text/html; charset=UTF-8'); + diff --git a/yarrg/web/script b/yarrg/web/script new file mode 100644 index 0000000..b8e7d03 --- /dev/null +++ b/yarrg/web/script @@ -0,0 +1,49 @@ +<%doc> + + This is part of the YARRG website. YARRG is a tool and website + for assisting players of Yohoho Puzzle Pirates. + + Copyright (C) 2009 Ian Jackson + Copyright (C) 2009 Clare Boothby + + YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later). + The YARRG website is covered by the GNU Affero GPL v3 or later, which + basically means that every installation of the website will let you + download the source. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + + Yohoho and Puzzle Pirates are probably trademarks of Three Rings and + are used without permission. This program is not endorsed or + sponsored by Three Rings. + + + This Mason component wraps Javascript which is to be embedded in HTML + pages to deal with some of the bizarre quoting problems and behaviours + in Javascript +<%init> +my $ct= $m->content; + +die "bad script content $&" + if $ct =~ m,\<\/|--\>,; +