cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Convert Hexadecimal data into text or redable format in thingworx

DT_9697337
6-Contributor

Convert Hexadecimal data into text or redable format in thingworx

I want convert hex data into text or readable format please check below hex data

 

55 55 00 5A 21 41 02 00 00 38 36 31 32 35 31 30 33 38 30 33 39 33 39 39 A5 08 D1 5D FC 2C 82 39 F9 6E 34 BF 14 B1 61 89 B5 E3 A4 2C 88 F4 A8 AA 0B 43 78 EE 7C 37 6A 94 27 A1 20 BF AF C7 3D F0 FE 25 B1 6D E7 4E F6 3A 35 3A D5 0F 91 83 0D 80 36 97 70 F6 DC E8 0A 81 AA AA

 

 please suggest the way how we can do it in thingworx

2 REPLIES 2
PaiChung
22-Sapphire I
(To:DT_9697337)

Just did a google search for javascript hex to string 

here is a result

function hex2a(hex) {
    var str = '';
    for (var i = 0; i < hex.length; i += 2) {
        var v = parseInt(hex.substr(i, 2), 16);
        if (v) str += String.fromCharCode(v);
    }
    return str;
}  

 

DT_9697337
6-Contributor
(To:PaiChung)

@PaiChung 

I have used this program to convert hex data it is working on few hex data only not working that i have shared below

55 55 00 5A 21 41 02 00 00 38 36 31 32 35 31 30 33 38 30 33 39 33 39 39 A5 08 D1 5D FC 2C 82 39 F9 6E 34 BF 14 B1 61 89 B5 E3 A4 2C 88 F4 A8 AA 0B 43 78 EE 7C 37 6A 94 27 A1 20 BF AF C7 3D F0 FE 25 B1 6D E7 4E F6 3A 35 3A D5 0F 91 83 0D 80 36 97 70 F6 DC E8 0A 81 AA AA

When i give above input as hex data following output which i got.

33.png

When i put below hex data in the same input, i got right conversion. Please check below image

47 75 79 73 20 54 68 61 6e 6b 73 2c 20 70 6c 65 61 73 65 20 73 75 70 70 6f 72 74 20 61 6e 64 20 77 69 73 68 20 6d 65 20 6f 6e 20 4c 69 6e 6b 65 64 49 6e 20 61 73 20 77 65 20 6e 65 65 64 20 74 6f 20 67 69 76 65 20 61 6c 6c 20 63 72 65 64 69 74 20 74 6f 20 43 6f 6e 6e 65 78 69 73 2c 20 6c 65 74 20 6f 75 72 20 70 61 74 72 6f 6e 73 2c 20 63 6c 69 65 6e 74 73 20 61 6c 73 6f 20 6e 6f 74 69 63 65 20 69 74 2e 20 49 74 27 73 20 61 6c 6c 20 6f 66 20 43 6f 6e 6e 65 78 69 73 20 74 65 61 6d 20 65 66 66 6f 72 74 73 2e 0a 0a

hexdatacorrect.png

 

What right way convert hex data,please suggest

Top Tags