force output in UTF-8 -- fixes German BYOD display and still works for English

This commit is contained in:
Eric House 2014-01-08 07:09:13 -08:00
parent f42fbf62c4
commit b45fcf2aa6

View file

@ -1,6 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# Copyright 2002 by Eric House (xwords@eehouse.org). All rights reserved. # Copyright 2002-2014 by Eric House (xwords@eehouse.org). All rights
# reserved.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -26,6 +27,8 @@ package xloc;
use strict; use strict;
use warnings; use warnings;
# force output in utf8
use open qw/:std :utf8/;
BEGIN { BEGIN {
use Exporter (); use Exporter ();
@ -160,18 +163,20 @@ sub GetNthTile($$) {
sub TileFace($) { sub TileFace($) {
my ( $tileR ) = @_; my ( $tileR ) = @_;
my $result;
my $str = ${$tileR}[2]; my $str = ${$tileR}[2];
if ( $str =~ /\'(.(\|.)*)\'/ ) { if ( $str =~ /\'(.(\|.)*)\'/ ) {
return $1; $result = $1;
} elsif ( $str =~ /\"(.+)\"/ ) { } elsif ( $str =~ /\"(.+)\"/ ) {
return $1; $result = $1;
} elsif ( $str =~ /(\d+)/ ) { } elsif ( $str =~ /(\d+)/ ) {
return chr($1); $result = chr($1);
} else { } else {
die "TileFace: unrecognized face format: $str"; die "TileFace: unrecognized face format: $str";
} }
return $result;
} }
sub TileValue($) { sub TileValue($) {