summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-26 11:38:21 +0200
committerYorhel <git@yorhel.nl>2009-09-26 11:43:09 +0200
commitb7fbaa1fbce414dfbab49f6d5ae0e9eaf882d45e (patch)
tree977f5a3d95ce0163ce40b91aba8fbed061d7f983
parentc160933061f58a0f64a6037c1db8b79fb725b495 (diff)
Properly handle UTF-8 in relation graph SVGs
This is a workaround for a bug in DBD::Pg: http://rt.cpan.org/Public/Bug/Display.html?id=40199 Also added a charset to the content type header of the relation graph pages, though this wasn't really necessary for my Firefox to work.
-rw-r--r--lib/VNDB/DB/VN.pm5
-rw-r--r--lib/VNDB/Handler/VNPage.pm2
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index c6499350..9c411794 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -5,6 +5,7 @@ use strict;
use warnings;
use Exporter 'import';
use VNDB::Func 'gtintype';
+use Encode 'decode_utf8';
our @EXPORT = qw|dbVNGet dbVNAdd dbVNEdit dbVNImageId dbVNCache dbScreenshotAdd dbScreenshotGet dbScreenshotRandom|;
@@ -101,6 +102,10 @@ sub dbVNGet {
join(', ', @select), join(' ', @join), \%where, $o{order},
);
+ if($o{what} =~ /relgraph/) {
+ $_->{svg} = decode_utf8($_->{svg}) for @$r;
+ }
+
if(@$r && $o{what} =~ /(anime|relations|screenshots)/) {
my %r = map {
$r->[$_]{anime} = [];
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index a479bf64..f244c098 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -41,7 +41,7 @@ sub rg {
$self->htmlFooter;
return;
}
- $self->resHeader('Content-Type' => 'application/xhtml+xml');
+ $self->resHeader('Content-Type' => 'application/xhtml+xml; charset=UTF-8');
# This is a REALLY ugly hack, need find a proper solution in YAWF
no warnings 'redefine';