chiark / gitweb /
set content-type charset and LC_CTYPE to UTF-8
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 14 Aug 2009 14:12:07 +0000 (15:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 14 Aug 2009 14:12:30 +0000 (15:12 +0100)
also add some forgotten files

yarrg/Commods.pm
yarrg/CommodsWeb.pm
yarrg/commod-email-processor
yarrg/commod-update-receiver
yarrg/web/autohandler [new file with mode: 0644]
yarrg/web/script [new file with mode: 0644]

index b90e6d7bff2f27e25689d8b3be7e91be3b52e32b..0f7ebd63a253919301b58c90855c42284c5295f7 100644 (file)
@@ -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;
index 46b32e6763ebb25d2b75f0f1a3a6670b63caf1a2..5f85511f5fed815f2d73e70e435c710a383e2daa 100644 (file)
@@ -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();
index 0c16cd196f8e6f53268c6003a9015f8e33f8977e..b395aa8d851fc1ede7bc385968b20b65d8758eca 100755 (executable)
@@ -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;
 
index 889913d3c6b717a5ebc41c71179c16072cf73860..f11442854c0f31bf4029600ac5a9b705fae0db3a 100755 (executable)
@@ -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 (file)
index 0000000..ba6c8b9
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+% $m->call_next;
+<%init>
+use CommodsWeb;
+set_ctype_utf8();
+$r->content_type('text/html; charset=UTF-8');
+</%init>
diff --git a/yarrg/web/script b/yarrg/web/script
new file mode 100644 (file)
index 0000000..b8e7d03
--- /dev/null
@@ -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 <ijackson@chiark.greenend.org.uk>
+ 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 <http://www.gnu.org/licenses/>.
+
+ 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 <script> tags.  See also:
+    http://javascript.about.com/library/blxhtml.htm
+    http://www.htmlhelp.com/tools/validator/problems.html#script
+
+</%doc>
+<script type="text/javascript">
+<!--
+<% $ct %>
+// -->
+</script>
+<%init>
+my $ct= $m->content;
+
+die "bad script content $&"
+    if $ct =~ m,\<\/|--\>,;
+</%init>