[interchange-cvs] interchange - danb modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Jan 29 22:52:38 UTC 2009


User:      danb
Date:      2009-01-29 22:52:38 GMT
Modified:  lib/Vend Order.pm Util.pm
Log:
Correct issue with hi-bit characters in search strings.

This corrects the "Wide character in subroutine entry" error that occurs when hi-bit
characters are used in a search. The failure was caused by Digest::MD5's reluctance
to process characters > 0xFF, so we just convert any search options to UTF8 before
calculating the MD5.

Courtesy of David Christensen <david at endpoint.com>.

Revision  Changes    Path
2.105                interchange/lib/Vend/Order.pm


rev 2.105, prev_rev 2.104
Index: Order.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Order.pm,v
retrieving revision 2.104
retrieving revision 2.105
diff -u -r2.104 -r2.105
--- Order.pm	5 Dec 2008 15:31:49 -0000	2.104
+++ Order.pm	29 Jan 2009 22:52:38 -0000	2.105
@@ -1,6 +1,6 @@
 # Vend::Order - Interchange order routing routines
 #
-# $Id: Order.pm,v 2.104 2008-12-05 15:31:49 racke Exp $
+# $Id: Order.pm,v 2.105 2009-01-29 22:52:38 danb Exp $
 #
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -29,7 +29,7 @@
 package Vend::Order;
 require Exporter;
 
-$VERSION = substr(q$Revision: 2.104 $, 10);
+$VERSION = substr(q$Revision: 2.105 $, 10);
 
 @ISA = qw(Exporter);
 
@@ -2134,8 +2134,14 @@
 		else {
 			my $item = $line->{'code'};
 			$line->{quantity} = int $line->{quantity};
+			my $invalid_qty_error = $::Variable->{MV_INVALID_QTY_ERROR}
+				|| "'%s' for item %s is not numeric/integer";                
+			if (my $invalid_qty_label = $::Variable->{MV_INVALID_QTY_LABEL}) {
+				$Vend::Session->{errorlabels}{mv_order_quantity} 
+					= $invalid_qty_label;
+			}
         	$Vend::Session->{errors}{mv_order_quantity} =
-				errmsg("'%s' for item %s is not numeric/integer", $quantity, $item);
+				errmsg($invalid_qty_error, $quantity, $item);
     	}
 
 		if($do_update and my $oe = $Vend::Cfg->{OptionsAttribute}) {



2.122                interchange/lib/Vend/Util.pm


rev 2.122, prev_rev 2.121
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.121
retrieving revision 2.122
diff -u -r2.121 -r2.122
--- Util.pm	8 Jan 2009 18:43:13 -0000	2.121
+++ Util.pm	29 Jan 2009 22:52:38 -0000	2.122
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.121 2009-01-08 18:43:13 docelic Exp $
+# $Id: Util.pm,v 2.122 2009-01-29 22:52:38 danb Exp $
 # 
 # Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,6 +26,8 @@
 package Vend::Util;
 require Exporter;
 
+use Encode qw(encode_utf8);
+
 @ISA = qw(Exporter);
 
 @EXPORT = qw(
@@ -91,7 +93,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.121 $, 10);
+$VERSION = substr(q$Revision: 2.122 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -596,7 +598,7 @@
 	$Keysub = sub {
 					@_ = time() unless @_;
 					$Md->reset();
-					$Md->add(@_);
+					$Md->add(map encode_utf8($_), @_);
 					$Md->hexdigest();
 				};
 }







More information about the interchange-cvs mailing list