diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-05-07 15:13:33 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-05-07 16:21:21 -0400 |
commit | 64e4f81ffc7173bfbbf83bb4485a29ede67a4824 (patch) | |
tree | 65ebc91f2eb2a325a24c68ce52f6aab2fadfa461 /tools/voice.pl | |
parent | 3348d8420663420fb46bc6d11e41703aa716af31 (diff) | |
download | rockbox-64e4f81ffc7173bfbbf83bb4485a29ede67a4824.tar.gz rockbox-64e4f81ffc7173bfbbf83bb4485a29ede67a4824.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
Diffstat (limited to 'tools/voice.pl')
-rwxr-xr-x | tools/voice.pl | 6 |
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 @@ | |||
17 | 17 | ||
18 | use strict; | 18 | use strict; |
19 | use warnings; | 19 | use warnings; |
20 | use utf8; | ||
20 | use File::Basename; | 21 | use File::Basename; |
21 | use File::Copy; | 22 | use File::Copy; |
22 | use vars qw($V $C $t $l $e $E $s $S $i $v $f $F); | 23 | use vars qw($V $C $t $l $e $E $s $S $i $v $f $F); |
@@ -25,8 +26,8 @@ use IPC::Open3; | |||
25 | use Digest::MD5 qw(md5_hex); | 26 | use Digest::MD5 qw(md5_hex); |
26 | use DirHandle; | 27 | use DirHandle; |
27 | use open ':encoding(utf8)'; | 28 | use open ':encoding(utf8)'; |
28 | use open ':std'; | 29 | use Encode::Locale; |
29 | use utf8; | 30 | use Encode; |
30 | 31 | ||
31 | sub printusage { | 32 | sub printusage { |
32 | print <<USAGE | 33 | print <<USAGE |
@@ -562,6 +563,7 @@ sub gentalkclips { | |||
562 | my ($dir, $tts_object, $encoder, $encoder_opts, $tts_engine_opts, $i) = @_; | 563 | my ($dir, $tts_object, $encoder, $encoder_opts, $tts_engine_opts, $i) = @_; |
563 | my $d = new DirHandle $dir; | 564 | my $d = new DirHandle $dir; |
564 | while (my $file = $d->read) { | 565 | while (my $file = $d->read) { |
566 | $file = Encode::decode( locale_fs => $file); | ||
565 | my ($voice, $wav, $enc); | 567 | my ($voice, $wav, $enc); |
566 | my $format = $tts_object->{'format'}; | 568 | my $format = $tts_object->{'format'}; |
567 | 569 | ||