diff options
author | Arne Georg Gleditsch <argggh@taniquetil.(none)> | 2009-08-11 22:25:27 +0200 |
---|---|---|
committer | Arne Georg Gleditsch <argggh@taniquetil.(none)> | 2009-08-11 22:25:27 +0200 |
commit | 8c0cc60f48005db0a2f5496d265deb85dd918fae (patch) | |
tree | 2c23cd7fd7f0e2b525f258a9e18dee2c0b47ac7b /lib/LXRng/Web.pm | |
parent | 18c9a9da17ebea409c56ef9118a0adcc536f05c4 (diff) |
Honour body_charset when displaying files.
Diffstat (limited to 'lib/LXRng/Web.pm')
-rw-r--r-- | lib/LXRng/Web.pm | 9 |
1 files changed, 9 insertions, 0 deletions
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}); |