File: entity-escape-xml

package info (click to toggle)
libmarc-xml-perl 1.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 248 kB
  • sloc: xml: 1,162; perl: 350; makefile: 2
file content (12 lines) | stat: -rwxr-xr-x 207 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;

use Unicode::Normalize;
binmode(STDIN,':utf8');

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