#!/usr/bin/perl
# a simple filter for a TeX generated by ScientificWorkPlace.
# by wkpark@kldp.org
# Public Domain
#
sub toutf8($) {
  my $c = shift(@_);
  return sprintf("%c%c%c",
                 0xe0 |  ($c >> 12),
                 0x80 | (($c >>  6) & 0x3f),
                 0x80 | ( $c        & 0x3f));
}

while (<>) {
  s/\\U\{([0-9a-f]{4})\}/toutf8(hex "$1")/ieg;
  print;
}