summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-05-07 15:13:33 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-05-07 16:21:21 -0400
commit64e4f81ffc7173bfbbf83bb4485a29ede67a4824 (patch)
tree65ebc91f2eb2a325a24c68ce52f6aab2fadfa461
parent3348d8420663420fb46bc6d11e41703aa716af31 (diff)
downloadrockbox-64e4f81ffc.tar.gz
rockbox-64e4f81ffc.zip
voice: Properly handle UTF8-encoded filenames when generating talkclips
Eg this was happening before: '11 - Breña.mp3' --> '11 - Breña.mp3' As well as resulting in incorrect voicing, it was breaking the encoding of the .wav to .talk. Change-Id: I6cf844d843ddf1a459f92e1ebd55c9feec886f55
-rwxr-xr-xtools/voice.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/voice.pl b/tools/voice.pl
index 337407e187..2c966cb0df 100755
--- a/tools/voice.pl
+++ b/tools/voice.pl
@@ -17,6 +17,7 @@
use strict;
use warnings;
+use utf8;
use File::Basename;
use File::Copy;
use vars qw($V $C $t $l $e $E $s $S $i $v $f $F);
@@ -25,8 +26,8 @@ use IPC::Open3;
use Digest::MD5 qw(md5_hex);
use DirHandle;
use open ':encoding(utf8)';
-use open ':std';
-use utf8;
+use Encode::Locale;
+use Encode;
sub printusage {
print <<USAGE
@@ -562,6 +563,7 @@ sub gentalkclips {
my ($dir, $tts_object, $encoder, $encoder_opts, $tts_engine_opts, $i) = @_;
my $d = new DirHandle $dir;
while (my $file = $d->read) {
+ $file = Encode::decode( locale_fs => $file);
my ($voice, $wav, $enc);
my $format = $tts_object->{'format'};