Page 1 of 2
Please help meï¼Œabout enter the characters &
Posted: 05 Jul 2009, 16:14
First of all I would like to thank the author's hard work.
However, I now have a troublesome problem.
When I enter the characters & in chat box, and then return, communications will be interrupted.
And Once I used the Chinese, not the normal chat function.Chat characters by??? Character replacement.
I beg your pardon, I am relatively poor English.
Who can help me,thank you very much!
Posted: 06 Jul 2009, 06:44
could you tell me exactly which example application is giving this problem to you?
Posted: 06 Jul 2009, 07:07
In this example "02_SimpleLobby".
When I connect the server to enter the hall,I enter a chat box characters '&'.
Press send button,"OnDisconnect" Function is triggered.
LoginGUI page displays.I did not set the skin parameter.
All are the default.
The same as example "SFSIslandDemo".
Your help would be very grateful.
In addition, I would like to know Chinese and Unicode characters, whether or not to support?
Thank you for your time.
Posted: 06 Jul 2009, 08:09
I see the problem too - both with unicode characters and a problem with sending &
I am on summer vacation right now (although mostly simply at home), so will take a look at it slowly over the next week or so.
In general Unity supports Chinese and unicode characters if the font you use supports it!!! The API itself should not restrict that (but has an error right now it seems).
I'll post here once I've dug into it, but as I said - dont expect a fix within days. Else my wife will kill me for not relaxing in summer vacation.
Posted: 06 Jul 2009, 12:29
hi,Thank you very much for the reply.I am very grateful to your work.I wish you a happy summer vacation.
Posted: 11 Jul 2009, 09:37
I'm running into some issues tracking this one down, but there is at least 1 bug in the API regarding character encoding.
In Util/Entities.cs you need to replace the top ascTab declerations with this:
Code: Select all
The difference being using a char as key vs. a string. The code tried to lookup using a string with a single char in it = not the same, so the hashtable never changed character.
The issue I have now is that the 1.6.6 server throws an exception. Server 1.6.5 works fine with the above.
But no matter what - above is an error fix that is valid no matter what. Will be included in next bugfix release
Tracking down the other bugs now with utf-8 characters.
Posted: 11 Jul 2009, 10:30
Just keeping you posted on progress
And I've found the problem with UTF-8 too - but not fixed it. It turns out that C# is using UTF-16 while Java is UTF-8. A few feeble attempts on my end to convert on send/receive have failed. Will try to dig through it some more - but it gives me a slight headache trying to make things work.
Posted: 12 Jul 2009, 14:36
Thanks for all your help,I have been in check the API Source code,and found the bug about class Entities hashtable.I was confused about this problem UTF8 and UTF16,Therefore, only do little tracking debugging.But I will continue to find the problem.
Posted: 12 Jul 2009, 14:51
I have personally given up on finding a solution to the problem, and will hand it over to a guy I know that might be able to dig it up.
I've tried tons of ways to encode the string send to the server end (and decode it the other way around).
Characters under 127 work fine - characters above code 127 do not.
If anyone wants to dig into it too, you should look at the WriteToSocket method in SmartFoxClient.cs. Here one can give various options to turn on/off the BOM in UTF8 encoding etc.etc.etc. - but either the characters still dont turn out right - or the server simply ignores what you send to it. Very frustrating.
Another thing to know is that C# uses little endian where Java uses big endian. So looking into doing some bitshuffling to rework the bytes send might be the key.
Any help or ideas are appreciated
Posted: 12 Jul 2009, 14:53
Code: Select all
ascTab.Add("'", "'");//Here I am not sure
ascTab.Add("\"", """);//Comparison of your code
I will continue to debug.
Posted: 12 Jul 2009, 14:55
Your code will not work. Please see my code post further up.
You have to use '' instead of "" to insert char keys instead of string based keys for it to work.
Only for the ascTab though
Posted: 12 Jul 2009, 15:06
I post that code is copy from API Souce code,I mean that ' charcode and \ charcode opposite.
'= &apos, \ = "
My English is very poor
char '' string "" I know what you mean
Posted: 12 Jul 2009, 15:14
Ahhh - right. I understand what you mean.
The ' is apostrophy - the ' character
The " is quote - the " character
The \ character comes solely from escaping the character after it - as you cannot write ''', but have to write '\''
I'm very sure its the code is correct as posted earlier (not as it is in the API sources)
Posted: 12 Jul 2009, 15:32
Chinese is pictographic,so I was not sensitive to letters,haha ,Thank you very much for help me.I'm very Appreciating you.
Posted: 12 Jul 2009, 18:50
Here one can give various options to turn on/off the BOM in UTF8 encoding etc.etc.etc. - but either the characters still dont turn out right - or the server simply ignores what you send to it. Very frustrating.
BOM should be turned off.
Maybe that's the problem. What other options have you got for UTF-8?