FS#9246 - Messaging from to sapi_voice.vbs mangled on Japanese Windows

Attached to Project: Rockbox
Opened by Jonas Häggqvist (rasher) - Wednesday, 06 August 2008, 17:03 GMT
Last edited by Jens Arnold (amiconn) - Thursday, 07 August 2008, 20:06 GMT
Task Type Bugs
Category Build environment
Status Closed
Assigned To Jonas Häggqvist (rasher)
Jens Arnold (amiconn)
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Based on comments in  FS#9148 , speculation is that Windows is not translating messages as if they were win1252, but something else.

Ideally, sapi_voice.vbs should be fixed so that strings are always passed in a consistent way.

One way, suggested by Taktak (Whick) is to encode the byte-value to ascii (numbers), and decode in sapi_voice.vbs. Patch for that in  FS#9148 .
This task depends upon

Closed by  Jens Arnold (amiconn)
Thursday, 07 August 2008, 20:06 GMT
Reason for closing:  Fixed
Additional comments about closing:  I've committed the patch, including a fix for the 'wide character' warning.
Comment by Jens Arnold (amiconn) - Wednesday, 06 August 2008, 19:07 GMT
I *think* I do understand the problem now. The vbscript assumes the passed data is in "pseudo-utf8", but this isn't true on japanese Windows (and probably other multibyte Windows variants). While converting everything into a list of bytes works, it's not an elegant solution. I have prepared a patch that does away with the UTF8decode() function in the vbscript altogether, and lets PerlIO do the conversion work. All data passing between and sapi_voice.vbs is now done in utf-16le (native windows encoding), meaning it should work on all language variants of Windows.

These changes should also be tested on linux, as one of the changes in will affect all platforms:

use open IN => ':utf8';
Comment by Jens Arnold (amiconn) - Wednesday, 06 August 2008, 19:21 GMT
Note: On cygwin it might be necessary to use the --binary option to apply the patch without getting failed hunks, i.e.:

patch -p0 --binary <sapi_unicode.diff
Comment by Taktak (Whick) - Thursday, 07 August 2008, 17:04 GMT
I have created japanese.lang and english.lang with this patch, cygwin and LH Naoko.
Thank you so much!

My rockbox with this lang file is able to speak japanese and english well!
Will you commit it?

But those long long error was printed on screen while I was making japanese.lang on cygwin.
.(see attached file)

Now, I don't know why. I'm sorry that I'll go bed now.