mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-13 09:52:00 -05:00
Check and UTF8-encode the names if needed
Fixes the "Wide character in subroutine entry" error for some UTF8 entries
This commit is contained in:
1 parent
75a919b283
commit
38a3d62f00
1 file changed
+4
-1
+4
-1
@@ -6,6 +6,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use Encode;
|
||||
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
use XML::DOM; # on ubuntu this requires 'libxml-dom-perl'
|
||||
@@ -32,7 +34,8 @@ close DICT;
|
||||
sub get_a_name {
|
||||
my $scalar = shift;
|
||||
return '' if !$scalar;
|
||||
my $index = hex substr(md5_hex($scalar),-$hex_digits);
|
||||
my $scalar_encoded = utf8::is_utf8($scalar) ? Encode::encode_utf8($scalar) : $scalar;
|
||||
my $index = hex substr(md5_hex($scalar_encoded),-$hex_digits);
|
||||
my $result = $dict[$index];
|
||||
chop $result;
|
||||
return $result;
|
||||
|
||||
Reference in new issue
Block a user