summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ucs/latexout.pl
blob: 78e80bb476f51a531ab001657fb8975d5aa22d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/perl -T -w

=head1 NAME

latexout.pl - Filters the LaTeX log and output, so that UTF8 stays UTF8.

=head1 SYNOPSIS

latex I<arguments> | latexout.pl

=head1 DESCRIPTION

TeX replaces bytes in the range of 0x80 to 0x9F by ^^xx
sequences. This filter restores them.

=head1 BUGS

Only complete lines are parsed, so when TeX wants input, the prompt is
not displayed.

=head1 AUTHOR

Dominique Unruh <I<unruh@ut.ee>>.

=head1 SEE ALSO

The LaTeX package B<ucs.sty>.

=cut

$| = 1;

while (<>) {
    s/\^\^([0-9a-f]{2})/chr hex $1/egi;
    print $_;
}