#!/usr/bin/perl
use strict;
use lib qw[/home/httpd/html/www/markup/html/whatpm
/home/wakaba/work/manakai2/lib
/home/httpd/html/swe/lib/];
use CGI::Carp qw[fatalsToBrowser];
require Message::CGI::Carp;
my $sw4_url = q
See other page.]; exit; sub get_page_url ($) { my $wiki_name = shift; $wiki_name = percent_encode ($wiki_name); $wiki_name =~ s/%2F/+/g; $wiki_name = $sw4_url . 'n/' . $wiki_name; return $wiki_name; } # get_page_url sub percent_encode ($) { my $s = Encode::encode ('utf8', $_[0]); $s =~ s/([^A-Za-z0-9_~-])/sprintf '%%%02X', ord $1/ges; return $s; } # percent_encode sub percent_decode ($) { # input should be a byte string. my $s = shift; $s =~ s/%([0-9A-Fa-f]{2})/pack 'C', hex $1/ge; return Encode::decode ('utf-8', $s); # non-UTF-8 octet converted to \xHH } # percent_decode sub percent_decode_byte ($) { # input should be a byte string. my $s = shift; $s =~ s/%([0-9A-Fa-f]{2})/pack 'C', hex $1/ge; return $s; } # percent_decode_byte sub htescape ($) { my $s = shift; $s =~ s/&/&/g; $s =~ s/</g; $s =~ s/"/"/g; return $s; } # htescape