Index: tools/voice.pl =================================================================== --- tools/voice.pl (revision 16863) +++ tools/voice.pl (working copy) @@ -267,7 +267,11 @@ close(ESPEAK); } case "sapi" { - print({$$tts_object{"stdin"}} "SPEAK\t$output\t$string\r\n"); + my $escape_string; + $escape_string = $string; + $escape_string =~ s/(.)/sprintf('%d,', ord($1))/eg; + chop($escape_string); + print({$$tts_object{"stdin"}} "SPEAK\t$output\t$escape_string\r\n"); } case "swift" { $cmd = "swift $tts_engine_opts -o \"$output\" \"$string\""; @@ -373,7 +377,7 @@ } else { voicestring($voice, $wav, $tts_engine_opts, $tts_object); - wavtrim($wav, 500, $tts_object); + # wavtrim($wav, 500, $tts_object); # 500 seems to be a reasonable default for now } Index: tools/sapi_voice.vbs =================================================================== --- tools/sapi_voice.vbs (revision 16863) +++ tools/sapi_voice.vbs (working copy) @@ -223,13 +223,15 @@ ' Decode an UTF-8 string into a standard windows unicode string (UTF-16) Function UTF8decode(ByRef sText) Dim i, c, nCode, nTail, nTextLen + Dim aData UTF8decode = "" + aData = Split(sText, ",", -1) nTail = 0 - nTextLen = Len(sText) - i = 1 + nTextLen = UBound(aData) + i = 0 While i <= nTextLen - c = Asc(Mid(sText, i, 1)) + c = CInt(AData(i)) i = i + 1 If c <= &h7F Or c >= &hC2 Then ' Start of new character If c < &h80 Then ' U-00000000 - U-0000007F, 1 byte @@ -249,7 +251,7 @@ While nTail > 0 And i <= nTextLen nTail = nTail - 1 - c = Asc(Mid(sText, i, 1)) + c = CInt(AData(i)) i = i + 1 If (c And &hC0) = &h80 Then ' Valid continuation char nCode = nCode * &h40 + (c And &h3F)