[open-ils-commits] r18598 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 3 21:03:43 EDT 2010
Author: gmc
Date: 2010-11-03 21:03:42 -0400 (Wed, 03 Nov 2010)
New Revision: 18598
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
Log:
add TT helper to squeeze strings into the UNOB straitjacket
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 at esilibrary.com>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm 2010-11-03 20:31:01 UTC (rev 18597)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm 2010-11-04 01:03:42 UTC (rev 18598)
@@ -3,6 +3,7 @@
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;
@@ -48,6 +49,15 @@
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;
More information about the open-ils-commits
mailing list