Mushclient can't hold some char in chinese OS

Posted by Ron on Wed 16 Dec 2009 12:09 PM — 3 posts, 12,883 views.

China #0
Hi Nick,

For my last posted question, I have found some more things.

The problem is , I hold a high-order char in a var (in any script) (0x81-0xFF), then call the function "setVariable". And when i get it with "getVariable" the return value is a empty string ''.

This is the test code :

highOrderChar = utils.fromhex ("80");
SetVariable("test", highOrderChar);
result = GetVariable("test");

print ("before set ", utils.tohex (highOrderChar))
print ("after set ", utils.tohex (result))


For "0x01" - "0x80" and "0xFF" the code work well, but it will return "" for "0x81" - "0xFE".

The problem only happened when the char number is odd number.

Please have a check.

PS. I downloaded the source of mushclient V4.43, but i can't understand them. (I am not familiar with C and Window programming :( )

Thanks.

Ron

Amended on Wed 16 Dec 2009 12:26 PM by Ron
China #1
Hi Nick,

I got the point.

As you said in SetVariable function help. I can use base64encode before SetVariable and decode it after GetVariable.

Thanks a lot.

Yours,

Ron
Australia Forum Administrator #2
I can't reproduce your results. This code shows all characters can be saved:


s = ""

for i = 1, 255 do
  s = s .. string.char (i)
end -- for

SetVariable("test", s)

result = GetVariable("test")

print ("same?", result == s)


Results:


same? true


I didn't expect 0 to work as that is a string terminator.

However using base64 encode and decode could be a workaround for you. Similarly for the database problem.