From 8c0cc60f48005db0a2f5496d265deb85dd918fae Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Tue, 11 Aug 2009 22:25:27 +0200 Subject: Honour body_charset when displaying files. --- lib/LXRng/Web.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/LXRng/Web.pm') diff --git a/lib/LXRng/Web.pm b/lib/LXRng/Web.pm index 9e9e24a..5b11a2d 100644 --- a/lib/LXRng/Web.pm +++ b/lib/LXRng/Web.pm @@ -132,6 +132,15 @@ sub print_markedup_file { my $handle = $node->handle(); LXRng::Lang->init($context); + my $index = $context->config->{'index'}; + my $charset = $index->get_file_charset($context->tree, $node->name, + $context->release); + $charset ||= 'ascii'; + + binmode($handle, ":encoding($charset)"); + binmode(STDOUT, ":encoding(utf-8)"); + binmode($cache, ":encoding(utf-8)") if $cache; + my $lang = LXRng::Lang->new($node); my $parse = LXRng::Parse::Simple->new($handle, 8, @{$lang->parsespec}); -- cgit v1.2.3