[interchange] Add checks for MV_UTF8 in global variable space

David Christensen interchange-cvs at icdevgroup.org
Sun Apr 18 18:31:57 UTC 2010


commit 9026f0b88a5812d26f6b919b2df9e5f524343b86
Author: David Christensen <david at endpoint.com>
Date:   Sun Apr 18 13:30:51 2010 -0500

    Add checks for MV_UTF8 in global variable space
    
    Depending on the context in which a particular piece of code is
    called, $::Variable will be aliased to either the variables defined in
    interchange.cfg (i.e., $Global::Variable) or in the specific
    catalog.cfg.
    
    In order to handle the fact that MV_UTF8 can be defined in either
    interchange.cfg or catalog.cfg, change all checks to look at both
    $::Variable and $Global::Variable explicitly.
    
    This is known to have affected the [import] tag at the very least, and
    likely had other subtle implications in other places.

 lib/Vend/File.pm         |    4 ++--
 lib/Vend/Server.pm       |    2 +-
 lib/Vend/Table/Common.pm |    2 +-
 lib/Vend/Util.pm         |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/lib/Vend/File.pm b/lib/Vend/File.pm
index f880405..d9128d8 100644
--- a/lib/Vend/File.pm
+++ b/lib/Vend/File.pm
@@ -65,7 +65,7 @@ sub writefile {
     my($file, $data, $opt) = @_;
 	my($encoding, $fallback);
 
-	if ($::Variable->{MV_UTF8}) {
+	if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) {
 		$encoding = $opt->{encoding} ||= 'utf-8';
 		undef $encoding if $encoding eq 'raw';
 		$fallback = $opt->{fallback};
@@ -197,7 +197,7 @@ sub readfile {
 
 	$opt ||= {};
 	
-	if ($::Variable->{MV_UTF8}) {
+	if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) {
 		$encoding = $opt->{encoding} ||= 'utf-8';
 		$fallback = $opt->{fallback};
 		$fallback = Encode::PERLQQ() unless defined $fallback;
diff --git a/lib/Vend/Server.pm b/lib/Vend/Server.pm
index 854d4e2..85b95c3 100644
--- a/lib/Vend/Server.pm
+++ b/lib/Vend/Server.pm
@@ -482,7 +482,7 @@ sub parse_multipart {
 			$content_type ||= 'text/plain';
 			$charset ||= default_charset();
 			
-			if ($content_type =~ m{^text/}i && $::Variable->{MV_UTF8}) {
+			if ($content_type =~ m{^text/}i && ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8})) {
 				Vend::CharSet::to_internal($charset, \$data);
 				# use our character set instead of the client's one
 				# to store the file
diff --git a/lib/Vend/Table/Common.pm b/lib/Vend/Table/Common.pm
index d796b3f..a5b04e2 100644
--- a/lib/Vend/Table/Common.pm
+++ b/lib/Vend/Table/Common.pm
@@ -1636,7 +1636,7 @@ sub log_error {
 
 sub new_filehandle {
 	my $fh = shift;
-	binmode($fh, ":utf8") if $::Variable->{MV_UTF8};
+	binmode($fh, ":utf8") if $::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8};
 	return $fh;
 }
 
diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm
index ecbafba..ed4a1c7 100644
--- a/lib/Vend/Util.pm
+++ b/lib/Vend/Util.pm
@@ -1179,7 +1179,7 @@ sub readin {
 
 		if (open(MVIN, "< $fn")) {
 			binmode(MVIN) if $Global::Windows;
-			binmode(MVIN, ":utf8") if $::Variable->{MV_UTF8};
+			binmode(MVIN, ":utf8") if $::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8};
 			undef $/;
 			$contents = <MVIN>;
 			close(MVIN);



More information about the interchange-cvs mailing list