File: entity-escape-xml

package info (click to toggle)
libmarc-xml-perl 0.93-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 224 kB
  • sloc: xml: 1,159; perl: 406; makefile: 2
file content (8 lines) | stat: -rwxr-xr-x 179 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
#!/usr/bin/perl
use Unicode::Normalize;
binmode(STDIN,':utf8');

while (my $stuff = NFC(<>)) {
	$stuff =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
	print $stuff;
}