The force_jedi_unob helper strips non-ASCII characters from
template output but does so nicely by converting the string
to NFD first. This is meant to be used by EDI templates, although
could be useful for A/T output that goes to receipt
printers that cannot print diacritics.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18598
dcc99617-32d9-48b4-a31d-
7c20da2025e4
use Template;
use DateTime;
use DateTime::Format::ISO8601;
+use Unicode::Normalize;
use OpenSRF::Utils qw/:datetime/;
use OpenSRF::Utils::Logger qw(:logger);
use OpenILS::Application::AppUtils;
return $str;
},
+ # strip non-ASCII characters after splitting base characters and diacritics
+ # least common denominator for EDIFACT messages using the UNOB character set
+ force_jedi_unob => sub {
+ my $str = shift;
+ $str = NFD($str);
+ $str =~ s/[\x{0080}-\x{fffd}]//g;
+ return $str;
+ },
+
# returns the calculated user locale
get_user_locale => sub {
my $user_id = shift;