Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Mushclient can't hold some char in chinese OS

Mushclient can't hold some char in chinese OS

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ron   China  (15 posts)  Bio
Date Wed 16 Dec 2009 12:09 PM (UTC)

Amended on Wed 16 Dec 2009 12:26 PM (UTC) by Ron

Message
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

Top

Posted by Ron   China  (15 posts)  Bio
Date Reply #1 on Wed 16 Dec 2009 01:10 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 16 Dec 2009 07:21 PM (UTC)

Amended on Wed 16 Dec 2009 07:22 PM (UTC) by Nick Gammon

Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,225 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.