Skip to content

Commit 9026f0b

Browse files
author
David Christensen
committed
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.
1 parent d591b9a commit 9026f0b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/Vend/File.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ sub writefile {
6565
my($file, $data, $opt) = @_;
6666
my($encoding, $fallback);
6767

68-
if ($::Variable->{MV_UTF8}) {
68+
if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) {
6969
$encoding = $opt->{encoding} ||= 'utf-8';
7070
undef $encoding if $encoding eq 'raw';
7171
$fallback = $opt->{fallback};
@@ -197,7 +197,7 @@ sub readfile {
197197

198198
$opt ||= {};
199199

200-
if ($::Variable->{MV_UTF8}) {
200+
if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) {
201201
$encoding = $opt->{encoding} ||= 'utf-8';
202202
$fallback = $opt->{fallback};
203203
$fallback = Encode::PERLQQ() unless defined $fallback;

lib/Vend/Server.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ sub parse_multipart {
482482
$content_type ||= 'text/plain';
483483
$charset ||= default_charset();
484484

485-
if ($content_type =~ m{^text/}i && $::Variable->{MV_UTF8}) {
485+
if ($content_type =~ m{^text/}i && ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8})) {
486486
Vend::CharSet::to_internal($charset, \$data);
487487
# use our character set instead of the client's one
488488
# to store the file

lib/Vend/Table/Common.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ sub log_error {
16361636

16371637
sub new_filehandle {
16381638
my $fh = shift;
1639-
binmode($fh, ":utf8") if $::Variable->{MV_UTF8};
1639+
binmode($fh, ":utf8") if $::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8};
16401640
return $fh;
16411641
}
16421642

lib/Vend/Util.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ sub readin {
11791179

11801180
if (open(MVIN, "< $fn")) {
11811181
binmode(MVIN) if $Global::Windows;
1182-
binmode(MVIN, ":utf8") if $::Variable->{MV_UTF8};
1182+
binmode(MVIN, ":utf8") if $::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8};
11831183
undef $/;
11841184
$contents = <MVIN>;
11851185
close(MVIN);

0 commit comments

Comments
 (0)