#!/usr/bin/perl # convert Diagram! EUC sequence to Omnigraffle Shift JIS hex # nkf -s part-of.diagram2/DiagramText | ~/bin/fix-diagram2.pl > tmp.txt; mv tmp.txt part-of.diagram2/DiagramText my $file = $ARGV[0]; if ($file !~ /diagram2\/DiagramText$/ || ! -f $file ) { die "Usage $0 *.diagram2/DiagramText"; } system("cp $file $file.orig"); open(INPUT,"nkf -s $file.orig|") or die "Usage $0 *.diagram2/DiagramText"; open(OUTPUT,">", $file); while() { s/([\200-\377])(.)/sprintf("\\'%02x\\'%02x",ord($1),ord($2))/eg; s/\\fonttbl\\f0\\fnil/\\fonttbl\\f0\\fnil\\fcharset128/g; print OUTPUT; }