Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Your Hex2String script

Reply
 
Old 09-15-2009   #1 (permalink)
Fred Sens


 
 

Your Hex2String script

You are required to be a member to post replies. After logging in or becoming a member, you will be redirected back to this page.



Posted as a reply to:

Re: Hex to string

KAKA schrieb:


Actually you seem to try to convert wide char key codes (UTF-16)
of little endian notation into a string.

Try this one, which does not rely on padding '00':


WScript.Echo Hex2String("4D006F006E00690074006F0072")

Function Hex2String(s)
Dim i, c
For i = 1 To Len(s) Step 4
c = c & ChrW(CLng("&H" & Mid(s,i+2,2) & Mid(s,i,2)))
Next
Hex2String = c
End Function


Note that you can rely on a pattern with double-nulls in every 3rd and
4th position as long as the string is fully UTF-8-compatible
(no keycode > 255 / FF00)

Also, as for chars from 128-255, you'd probably need some
remapping from UTF-8 to ASCII.



MfG,
Alex





MfG,
Alex

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorials...vices-usi.aspx

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Logon Script Causing Laptops To Hang - Problems in script? VB Script
problem passing args to script 'There is no script engine for file extenstion' VB Script
Include another script, keep variables in included script? PowerShell
Script file has 'OS Handle' error when run from script PowerShell
Can you drag-n-drop a file on top of a PS script to run the script? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46