[interchange/STABLE_5_6-branch] Add checks for MV_UTF8 in global variable space

David Christensen <[email protected]>
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit 5a1bb86e6d8cab60faeef321752aa8212b81d33b
Author: David Christensen <[email protected]>
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         |    2 +-
 lib/Vend/Table/Common.pm |    2 +-
 lib/Vend/Util.pm         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/lib/Vend/File.pm b/lib/Vend/File.pm
index caf7af7..bb45a01 100644
--- a/lib/Vend/File.pm
+++ b/lib/Vend/File.pm
@@ -60,7 +60,7 @@ sub writefile {
     my($file, $data, $opt) = @_;
 
 	my $is_utf8;
-	$is_utf8 = is_utf8(ref $data ? $$data : $data) if $::Variable->{MV_UTF8};
+	$is_utf8 = is_utf8(ref $data ? $$data : $data) if $::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8};
 
 	$file = ">>$file" unless $file =~ /^[|>]/;
 	if (ref $opt and $opt->{umask}) {
diff --git a/lib/Vend/Table/Common.pm b/lib/Vend/Table/Common.pm
index 1148610..3de4299 100644
--- a/lib/Vend/Table/Common.pm
+++ b/lib/Vend/Table/Common.pm
@@ -1633,7 +1633,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 246c18d..4f58139 100644
--- a/lib/Vend/Util.pm
+++ b/lib/Vend/Util.pm
@@ -1189,7 +1189,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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.