Unicode string to hex not working - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: Unicode string to hex not working (/showthread.php?tid=76765) Unicode string to hex not working by GNSPS on 08-14-2007 at 01:08 AM
Why does this: code: Always output the first letter of the unicode string??? Can't figure it out... Edit: more debuging showed me that the bitwise AND is outputing the charcode itself and the right bit shift is outputing "0". RE: Unicode string to hex not working by Adeptus on 08-14-2007 at 02:03 AM
What is this supposed to do? It may be best if you can post a small sampe of input and desired output. RE: Unicode string to hex not working by GNSPS on 08-14-2007 at 02:55 AM it's ok... I really wanted to get the unicode string divided into bytes for memory patching... But now I realised that the function splitting is working, what's not working is the 'for' loop... Strange... XD RE: Unicode string to hex not working by Adeptus on 08-14-2007 at 03:34 AM
quote:I suspect the "for" loop is working fine. Since all the character codes of the English and Western European alphabets, digits and punctuation are below 255, the behavior you describe -- the bitwise "and" producing a value equal to the character code and the shift producing a zero -- is exactly what I'd expect. If you are expecting some other result and still need help with it, please describe what it should be. RE: Unicode string to hex not working by GNSPS on 08-14-2007 at 11:59 AM Yeah I know that it was the expected behavior of this function, but I don't get why in the end the variable 'newstring' outputs just the first letter of the unicode string... And that's not supposed to happen! RE: Unicode string to hex not working by Matti on 08-14-2007 at 12:40 PM
Well, String.fromCharCode(0) would give you a null-character, and a null-character means the end of a string. So, if you trace the result, the debugger will only show the first letter. If you try to send a Unicode-only character to the function (e.g. "€"), it'll give you "¬ " as output. RE: Unicode string to hex not working by GNSPS on 08-14-2007 at 01:09 PM but i don't get it then, this function is made by CookieRevised and it worked in the beginning... Now it's not working... it was supposed to add to the "newstring" string the first high order byte and then the low order one of the char... "sigh" is equal to this:" 0x73 0x00 0x69 0x00 0x67 0x00 0x68 0x00 " or this:" \x73\x69\x67\x68" and that's why the every char of the string is being divided into the high order byte and low order one (which should be the 0x00 part of the byte string not the terminating character XD). Did you get it already? But thanks for explaining me why the 'newstring' was always the first letter of the unicode string, I hadn't thought about it. RE: Unicode string to hex not working by Matti on 08-14-2007 at 03:33 PM
In that case, I think you should just drop the String.fromCharCode(). It'll convert your number into a character, and since you want numbers you just have to leave them out, no? code:But this functions will only join the decimal numbers together... Do you want spaces between the numbers? Do you want the numbers to be hexadecimal? You really should give us a clear explanation of what your function has to do. RE: Unicode string to hex not working by GNSPS on 08-14-2007 at 08:14 PM
I got the answer to my problem it appears that WLM 8.5 changes the font address in memory everytime it runs... =S And so it can't be patched so the problem wasn't the funtion at all was the address I was supplying to the WriteProcessMemory function xD Thanks for your great help anyway Mattike! |