473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

decoding problem?

Hello Everyone,
can anybody tell me how to encode/decode this data mention below

Input file sample.s37
S00F000053424C5F352E30352E3000008A
S315FFFFB800541A63FF090063E7050063EF0100400772
S315FFFFB81025B640070CB6400704B60162406790B6EF

output file sample.kbf
Tc c c @%@ @b@g@ @@g ^`_ ^ F? f 6aH? `7`g? V.7

i've already applied some UTF-8/16/32/EBCD/ASCII, UCS Technique

Expand|Select|Wrap|Line Numbers
  1. use Encode;
  2. use strict;
  3. {
  4. open (INPUT, "sample.s37");
  5. open (OUTPUT, ">sample.kbf");
  6. binmode(INPUT);
  7. binmode(OUTPUT);
  8. my ($n, $data, $buf);
  9. while ($data=<INPUT>)
  10. {
  11.  read (INPUT, $data, 2 );
  12.   $data = encode('UTF-16', $data);
  13.  print OUTPUT "$data ";
  14.  read (INPUT, $data, 8 );
  15.   $data = encode('UTF-16', $data);
  16.  print OUTPUT "$data ";
  17.  read (INPUT, $data, 2 );
  18.   $data = encode('UTF-16', $data);
  19.   print OUTPUT "$data ";
  20.   read (INPUT, $data, 32 );
  21.  $data = encode('UTF-16', $data);
  22.  print OUTPUT ": $data ";
  23.  read (INPUT, $data, 2 );
  24.  $data = encode('UTF-16', $data);
  25.  print OUTPUT "$data \n";
  26. }
  27. close(INPUT);
  28. close(OUTPUT);
  29. }
  30.  
  31. open (OUTPUT, "sample.kbf");
  32. binmode(OUTPUT);
  33. while ($data=<OUTPUT>)
  34. {
  35.  read (INPUT, $data, 2 );
  36.   $data = decode('UTF-16', $data);
  37.  print OUTPUT "$data ";
  38.  read (INPUT, $data, 8 );
  39.   $data = decode('UTF-16', $data);
  40.  print OUTPUT "$data ";
  41.  read (INPUT, $data, 2 );
  42.   $data = decode('UTF-16', $data);
  43.   print OUTPUT "$data ";
  44.   read (INPUT, $data, 32 );
  45.  $data = decode('UTF-16', $data);
  46.  print OUTPUT ": $data ";
  47.  read (INPUT, $data, 2 );
  48.  $data = decode('UTF-16', $data);
  49.  print "$data\n";
  50. }
  51. close(OUTPUT);
  52. }
  53.  
  54.  


Thanks & Regard.
Lokiiii
Oct 22 '07 #1
2 1571
numberwhun
3,509 Expert Mod 2GB
Hello Everyone,
can anybody tell me how to encode/decode this data mention below

Input file sample.s37
S00F000053424C5F352E30352E3000008A
S315FFFFB800541A63FF090063E7050063EF0100400772
S315FFFFB81025B640070CB6400704B60162406790B6EF

output file sample.kbf
Tc c c @%@ @b@g@ @@g ^`_ ^ F? f 6aH? `7`g? V.7

i've already applied some UTF-8/16/32/EBCD/ASCII, UCS Technique

Expand|Select|Wrap|Line Numbers
  1. use Encode;
  2. use strict;
  3. {
  4. open (INPUT, "sample.s37");
  5. open (OUTPUT, ">sample.kbf");
  6. binmode(INPUT);
  7. binmode(OUTPUT);
  8. my ($n, $data, $buf);
  9. while ($data=<INPUT>)
  10. {
  11.  read (INPUT, $data, 2 );
  12.   $data = encode('UTF-16', $data);
  13.  print OUTPUT "$data ";
  14.  read (INPUT, $data, 8 );
  15.   $data = encode('UTF-16', $data);
  16.  print OUTPUT "$data ";
  17.  read (INPUT, $data, 2 );
  18.   $data = encode('UTF-16', $data);
  19.   print OUTPUT "$data ";
  20.   read (INPUT, $data, 32 );
  21.  $data = encode('UTF-16', $data);
  22.  print OUTPUT ": $data ";
  23.  read (INPUT, $data, 2 );
  24.  $data = encode('UTF-16', $data);
  25.  print OUTPUT "$data \n";
  26. }
  27. close(INPUT);
  28. close(OUTPUT);
  29. }
  30.  
  31. open (OUTPUT, "sample.kbf");
  32. binmode(OUTPUT);
  33. while ($data=<OUTPUT>)
  34. {
  35.  read (INPUT, $data, 2 );
  36.   $data = decode('UTF-16', $data);
  37.  print OUTPUT "$data ";
  38.  read (INPUT, $data, 8 );
  39.   $data = decode('UTF-16', $data);
  40.  print OUTPUT "$data ";
  41.  read (INPUT, $data, 2 );
  42.   $data = decode('UTF-16', $data);
  43.   print OUTPUT "$data ";
  44.   read (INPUT, $data, 32 );
  45.  $data = decode('UTF-16', $data);
  46.  print OUTPUT ": $data ";
  47.  read (INPUT, $data, 2 );
  48.  $data = decode('UTF-16', $data);
  49.  print "$data\n";
  50. }
  51. close(OUTPUT);
  52. }
  53.  
  54.  


Thanks & Regard.
Lokiiii
Lokiiii,

Changing the subject of your posting, but including the same information, does not mean you are going to get a different answer.

As I mentioned in your last thread, you are going to have to examine the code of the other program you mentioned and find out exactly what it is doing to the data in order to duplicate it. Without that knowledge nobody will probably be able to assist you.

Regards,

Jeff
Oct 22 '07 #2
Lokiiii,

Changing the subject of your posting, but including the same information, does not mean you are going to get a different answer.

As I mentioned in your last thread, you are going to have to examine the code of the other program you mentioned and find out exactly what it is doing to the data in order to duplicate it. Without that knowledge nobody will probably be able to assist you.

Regards,

Jeff
hello jeff,
hey this is not same quetion. before that i had asked about binary file. and i'd asked not making binary file because data coming same but here i made it binary file and data is not coming in binary by encoding technique but data not decoding... and earlier you don't about this and not now. if you know encoding/decoding so please give me answer except giving...perl.org encode


thanks & regards
Lokiiii
Oct 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: steve | last post by:
Hi, I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some...
1
by: Thomas Williams | last post by:
Hello everyone, my name is Tom W. And, I am new to the list, and have been using Python for about a year now. Anyway, I got a question! I am trying to decode MIME (base64) email from a POP3...
0
by: Mark Rodrigues | last post by:
Hi everyone, Today we hit a problem when we rolled a new web-site are were presented with a error on our page that looked like: Security Exception Description: The application attempted to...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
1
by: Slade | last post by:
Hi, I'm trying to use POST an image to a web page with WebRequest/WebResponse. Only problem is that I must be making an error somewhere in the encoding/decoding process. I've pasted below a bit...
5
by: Peter Jansson | last post by:
Hello group, The following code is an attempt to perform URL-decoding of URL-encoded string. Note that std::istringstream is used within the switch, within the loop. Three main issues have been...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
2
by: pmz | last post by:
Dear Group, I've got a problem with decoding e-mail message subject, which has been read within usage of Pear_Mail_Mime library. There are some elements unwelcome in my subject string, such...
0
by: Michele | last post by:
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.