Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 2 made on Sunday January 27, 2008 at 11:50
Rene Lou
Long Time Member
Joined:
Posts:
January 2008
19
Hi

I just implemented a small function, adding as many spaces to a string as necessary to prevent loss of data when storing a variable globally:

function Add_Space_Error(data)
{
for (i=0; i < data.length; i++)
if (data.charCodeAt(i) > 127) data += " ";
return(data);
}

If there is a binary string you want to store globally and not shure if there are any bytes between "\x80" and "xFF", just add this function before storing your data.

Eg. (for the example above):

System.setGlobal("test_string", Add_Space_Error("blabla" + "\xf2\xf3" + "blabla"));
var tmp = System.getGlobal("test_string");
System.print(tmp);

your string tmp will look correctly again: "blabla" + "\xf2\xf3" + "blabla"

This simply adds as many spaces to the string before storing as ProntoScript will cut -> bingo, my scripts are working again! :-)

Rene


Hosting Services by ipHouse