Thank you for the quick reply.
Function pack(value As Integer)
result = ""
result += chr(value >> 8 and 255)
result += chr(value and 255)
For PHP the function pack("n", 333) will return a string "[SOH]M" where [SOH] is ascii symbol SOH. Roku will return "?M"
I am missing something and I can't figure what.
Later edit: found my issue.
value >> 8 and 255 evaluates to 0 and chr(0) returns empty string if the specified value is 0 or an invalid Unicode value, as per the documentation. I need to preppend the ASCII 0 character, which is NUL. Any ideas how to do that?