The Gate Keeper Posted July 1, 2007 Report Share Posted July 1, 2007 what you could do is make a socket send routine clean (meaning not compensating for UTF-8), and just make a function to convert string back from UTF-8 back to ASCII. Then you could something like socketsend utfback(<stringone>) 
 utfback(<stringtwo>) Hopefully this works. Ohh, and all these attempts are based off MSN chat, so they may not even work, but that is how the MSN ocx responded to new lines and that. So hopefully it gets you somewhere. If this doesn't work, you could try using linefeed in place, but as i said, i believe when you use linefeed, the server is expecting a new command, not a continuation of the privmsg. Link to comment Share on other sites More sharing options...
Psych Posted July 1, 2007 Author Report Share Posted July 1, 2007 Okay, what I did was this first of all after I read your first post, "PRIVMSG %#TESTROOM :S Tahoma;0 First Line " & ASCI.GetString(UTF.GetBytes("
")) & "Second Line" Where ASCI and UTF are instances of the Ascii and UTF8 encoding classes respectively. Basically, I've decoded the string into ascii so the send routine can encode it back as it should (into UTF8). This didn't work, what I got looked like this. BotNic : First Line ꋃ苢슬Second Line The 3 boxes decode (in UTF) as bytes (43),(111),(115),(79),(67),(52),(115),(75)(45), and (115) I tried this with all 3 examples you gave with more or less the same results (I think the last one gave me 4 boxes). Link to comment Share on other sites More sharing options...
The Gate Keeper Posted July 1, 2007 Report Share Posted July 1, 2007 you shouldn't need to convert them at all. Like, the characters i gave you were "raw", meaning, they were in the form that you should send them to the server as. There is no need for any converting. Link to comment Share on other sites More sharing options...
Webagent007 Posted July 1, 2007 Report Share Posted July 1, 2007 The problem with using line feed is that the server is expecting a new command. When you do line feed, it expects that you are doing a new command straight after. I'm reasonably sure this is why it's not working. Oh you are right, now I remember! you can't send more lines unless you use some weird unicode thingy. I remember some people used it to make asci art, don't we have that around here on TG? Link to comment Share on other sites More sharing options...
Ozzy10 Posted July 1, 2007 Report Share Posted July 1, 2007 the following were line returns on msn 
  I may be wrong, but i think they have these blocked on buz anyway Link to comment Share on other sites More sharing options...
hixxy Posted July 1, 2007 Report Share Posted July 1, 2007 Wrong. What you need to do is this: "PRIVMSG %#TESTROOM :S Tahoma;0 First Line" & Chr(239) & "Second Line" He is not wanting to send a crlf, but rather to make the next line appear on a new line in an msn web chatroom. I see, well I wouldn't know about that. But you can send multiple messages the way I showed, which is just as good. Link to comment Share on other sites More sharing options...
Pyscho Posted July 1, 2007 Report Share Posted July 1, 2007 (edited) Pysch, haven't you tried it without all the UTF encoding stuff? Just sending "PRIVMSG %#TESTROOM :S Tahoma;0 First Line" & Chr(239) & "Second Line" works fine here. Edited July 1, 2007 by Pyscho Link to comment Share on other sites More sharing options...
Psych Posted July 1, 2007 Author Report Share Posted July 1, 2007 Okay, I have a linefeed, lol. Its all about encoding, I was puzzled how a chr(10) could come from the server when a chr(10) couldnt be sent. The socket class I wrote already had a raw byte property in its datarecieved event, so I examined that (its not encoded). I found that there are 3 bytes that decode to chr(10), those are chr(226),chr(128) and chr(169). Ironically, those bytes encode to "
". Your all laughing, right? Well, it isnt that simple, because you cannot decode "
" and get that 3 byte array (not using any decoder that ships with vbexpess, anyway), trust me, I tried them all. Of course, you could iterate through the string and build your byte array that way, and it would work like a charm, but you wouldnt be able to encode special characters correctly, and I wanted to keep that functionality). What I did was make a new collection (of Byte), then use the .AddRange method to add all the characters upto the chr(10) (UTF8 encoded), then use the .Add method to add the 226, 128 and 169 and then .AddRange again for the rest of the characters (UTF8 encoded). I pass the whole array using the .ToArray method. Works like a charm. I am going to write a routine into the Send method of my program to replace "/r/n" with that byte sequence. That should sort it. Thanks for your help guys (n girls lol) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now