473,549 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binary to ASCII

Could someone suggest a method to convert a Binary data to an ASCII
data, with very less or no increase in the memory . The problem
basically is there is an excrypted message which needs to be
transmitted via SMS (mobiles). SMS supports only transmitting of
printable char ie ASCII characters. I do know methords where in after
conversion the size becomes twice the original data. Does some one know
any better, optimal way to do the conversion.

May 17 '06 #1
10 3831
Wrecked said:
Could someone suggest a method to convert a Binary data to an ASCII
data, with very less or no increase in the memory . The problem
basically is there is an excrypted message which needs to be
transmitted via SMS (mobiles). SMS supports only transmitting of
printable char ie ASCII characters. I do know methords where in after
conversion the size becomes twice the original data. Does some one know
any better, optimal way to do the conversion.


Base 64 encoding is the canonical way to represent arbitrary data in text
format. Since it can only represent six bits with a single character,
however, you will have to put up with a 33% increase in data size. This
sure beats double, right?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 17 '06 #2
thanks for that.. but is that the best we could get.. since i will have
to transmit data via SMS, memory is bit constraint

May 17 '06 #3
Ico
Wrecked <ri********@gma il.com> wrote:
thanks for that.. but is that the best we could get.. since i will have
to transmit data via SMS, memory is bit constraint


You probably can not go much lower then base64 (about 33% size
increase). base64 uses only alphanumeric characters [a-zA-Z0-9]: if
you're transport mechanism allows for more symbols, you could implement
your own encoding, similar to base64, but with more characters.

If that's still to much for you, you could consider some simple
compression with a fixed huffman table, and base64 encode the compressed
data.

P.S. Please include context of the message you are replying to: quote
the relevant parts. If you insist on using the broken google-interface,
learn the following simple trick: if you reply to a message, first click
'options', then 'reply'. Google will now include the quoted message you
are replying to.
--
:wq
^X^Cy^K^X^C^C^C ^C
May 17 '06 #4
On 2006-05-17, Ico <us****@zevv.nl > wrote:
Wrecked <ri********@gma il.com> wrote:
thanks for that.. but is that the best we could get.. since i will have
to transmit data via SMS, memory is bit constraint
You probably can not go much lower then base64 (about 33% size
increase). base64 uses only alphanumeric characters [a-zA-Z0-9]: if
you're transport mechanism allows for more symbols, you could implement
your own encoding, similar to base64, but with more characters.


Look up "Ascii85" - it's used for binary data in PDF files.

http://en.wikipedia.org/wiki/Ascii85

Each group of four bytes is encoded as five ascii characters.
If that's still to much for you, you could consider some simple
compression with a fixed huffman table, and base64 encode the compressed
data.

P.S. Please include context of the message you are replying to: quote
the relevant parts. If you insist on using the broken google-interface,
learn the following simple trick: if you reply to a message, first click
'options', then 'reply'. Google will now include the quoted message you
are replying to.

May 17 '06 #5

Wrecked wrote:
Could someone suggest a method to convert a Binary data to an ASCII
data, with very less or no increase in the memory . The problem
basically is there is an excrypted message which needs to be
transmitted via SMS (mobiles). SMS supports only transmitting of
printable char ie ASCII characters. I do know methords where in after
conversion the size becomes twice the original data. Does some one know
any better, optimal way to do the conversion.


I would suggest you do a better research on SMS messages. It is
entirely off-topic here, but you're wrong in thinking you can only use
ASCII. I don't know which group discusses this (I have a guru on site),
but:

<OT style="way way OT, regulars stop reading NOW">
I suggest you look at the following:

[1]
New ETSI TS 100 901
V7.4.0 (1999-12) Digital cellular telecommunicati ons system (Phase 2+)
Technical realization of the Short Message Service (SMS)
(GSM 03.40 version 7.4.0 Release 1998)

[2]
New ETSI TS 100 900
V7.2.0 (1999-07)
Digital cellular telecommunicati ons system (Phase 2+);
Alphabets and language-specific information
(GSM 03.38 version 7.2.0 Release 1998)

[3] GSM 07.05 version 5.5.0
ETSI Digital cellular telecommunicati ons system (Phase 2+);
Use of Data Terminal Equipment - Data Circuit terminating;
Equipment (DTE - DCE) interface for
Short Message Service (SMS) and Cell Broadcast Service (CBS)

[4] www.nobbi.com PDUspy: PDU de/encoder (English) (great program,
includes access to the mobile phone's SMS via data cable),
Also: At command and PDU Information (German),
more GSM Software

New / replacment Spec. , see also www.3gpp.org or ETSI

[1] 3GPP TS 23.040
Used version:
4.4.0 Release 4 Also aviable at ETSI (ETSI TS 123 038,
or look at UTMS Spec. TS 23.040)

[2] 3GPP TS 23.038
Used version:
4.3.0 Release Also available at ETSI (ETSI TS 123 038,
or look at UTMS Spec. TS 23.038)
</OT>

May 17 '06 #6

Vladimir Oka wrote:
Wrecked wrote:
Could someone suggest a method to convert a Binary data to an ASCII
data, with very less or no increase in the memory . The problem
basically is there is an excrypted message which needs to be
transmitted via SMS (mobiles). SMS supports only transmitting of
printable char ie ASCII characters. I do know methords where in after
conversion the size becomes twice the original data. Does some one know
any better, optimal way to do the conversion.


I would suggest you do a better research on SMS messages. It is
entirely off-topic here, but you're wrong in thinking you can only use
ASCII. I don't know which group discusses this (I have a guru on site),
but:


Apologies. I totally glossed over the bit where you said you knew this
stuff.

May 17 '06 #7
On Wed, 17 May 2006 00:19:44 -0700, Wrecked wrote:
Could someone suggest a method to convert a Binary data to an ASCII data,
with very less or no increase in the memory . The problem basically is
there is an excrypted message which needs to be transmitted via SMS
(mobiles). SMS supports only transmitting of printable char ie ASCII
characters. I do know methords where in after conversion the size becomes
twice the original data. Does some one know any better, optimal way to do
the conversion.


Off topic, of course. An excellent example of why you'll get better
advice in a specialist group:

<OT (and not from an SMS expert)>
Doing any such conversion (you've had some good references already) is bit
peculiar. The reason is that 7-bit character data is sent in an SMS as
full octets by taking the "top" bits from following characters to pad out
the unused bits! This is why SMS can send either 160 "text" characters,
140 octets or 70 16-bit "wide" characters.

You are probably better off just sending the bytes as they are though, of
course, you get to send only 140 of them. Of course, if you can't
persuade your device to take the data, you may be forced into an "encoding"
in which case the best is simply to reverse the packing that SMS does:
just take seven bits at a time from your data, treating is as a bit
stream. The message system will then dutifully recreate your binary data
(though it will, of course, re-expand it for display on the receiving
phone).
</OT>

--
Ben.
May 17 '06 #8

"Vladimir Oka" <no****@btopenw orld.com> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...

Wrecked wrote:
Could someone suggest a method to convert a Binary data to an ASCII
data, with very less or no increase in the memory . The problem
basically is there is an excrypted message which needs to be
transmitted via SMS (mobiles). SMS supports only transmitting of
printable char ie ASCII characters. I do know methords where in after
conversion the size becomes twice the original data. Does some one know
any better, optimal way to do the conversion.


I would suggest you do a better research on SMS messages. It is
entirely off-topic here, but you're wrong in thinking you can only use
ASCII. I don't know which group discusses this (I have a guru on site),
but:

<OT style="way way OT, regulars stop reading NOW">
I suggest you look at the following:

[1]
New ETSI TS 100 901
V7.4.0 (1999-12) Digital cellular telecommunicati ons system (Phase 2+)
Technical realization of the Short Message Service (SMS)
(GSM 03.40 version 7.4.0 Release 1998)

[2]
New ETSI TS 100 900
V7.2.0 (1999-07)
Digital cellular telecommunicati ons system (Phase 2+);
Alphabets and language-specific information
(GSM 03.38 version 7.2.0 Release 1998)

[3] GSM 07.05 version 5.5.0
ETSI Digital cellular telecommunicati ons system (Phase 2+);
Use of Data Terminal Equipment - Data Circuit terminating;
Equipment (DTE - DCE) interface for
Short Message Service (SMS) and Cell Broadcast Service (CBS)

[4] www.nobbi.com PDUspy: PDU de/encoder (English) (great program,
includes access to the mobile phone's SMS via data cable),
Also: At command and PDU Information (German),
more GSM Software

New / replacment Spec. , see also www.3gpp.org or ETSI

[1] 3GPP TS 23.040
Used version:
4.4.0 Release 4 Also aviable at ETSI (ETSI TS 123 038,
or look at UTMS Spec. TS 23.040)

[2] 3GPP TS 23.038
Used version:
4.3.0 Release Also available at ETSI (ETSI TS 123 038,
or look at UTMS Spec. TS 23.038)
</OT>


You need to develop a consistent method of replying to off
topic subjects.

May 17 '06 #9
Barry wrote:

You need to develop a consistent method of replying to off
topic subjects.


It would become too boring.

May 18 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3212
by: rbt | last post by:
Is there an easy way to exclude binary files (I'm working on Windows XP) from the file list returned by os.walk()? Also, when reading files and you're unsure as to whether or not they are ascii or binary, I've always thought it safer to 'rb' on the read, is this correct... and if so, what's the reasoning behind this? Again all of this...
10
9089
by: J. Campbell | last post by:
OK...I'm in the process of learning C++. In my old (non-portable) programming days, I made use of binary files a lot...not worrying about endian issues. I'm starting to understand why C++ makes it difficult to read/write an integer directly as a bit-stream to a file. However, I'm at a bit of a loss for how to do the following. So as not to...
13
3534
by: greg | last post by:
Hello, I'm searching to know if a local file is ascii or binary. I couldn't find it in the manual, is there a way to know that ? thanks, -- greg
10
3632
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in binary mode. according to me, notepad opens files and each byte of the file read, it converts that byte from ascii to its correct character and...
13
22076
by: HNT20 | last post by:
Hello All i am new to python language. i am working on a gnuradio project where it uses python as the primary programming language. i am trying to convert a message, text, or numbers into binary code so that i can process it. i googled many times and tried many of the answers out there, no luck so far. is there a way to convert a...
68
5176
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
9
1943
by: ruffiano | last post by:
Hi, can someone tell me if a C++ string (std::string) represents a binary or an ASCII string? Thanks in advance.
5
2889
by: bwv539 | last post by:
I have to output data into a binary file, that will contain data coming from a four channel measurement instrument. Since those data have to be read from another C program somewhere else, the reading program must know how many channels have been acquired, date, time, and so on. I mean that the position of each datum is not fixed in the file...
3
3487
by: logaelo | last post by:
Hello all, Could anyone explain how to optimization this code? In the prosess of optimization what is the factor needed and important to know about it? Thank you very much for all. /********************************************************/ /* Binary converter */ /* By Matt Fowler ...
5
2572
by: Canned | last post by:
Hi, I'm trying to write a class that can convert ascii to binary and vice versa. I write my class based on this function I've found on internet That works perfectly, but when I try to implement it in my own class it gives me alot of headache, also because I'm totally new to the language. It work only with one character at a time, and if I...
0
7526
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7723
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7483
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6051
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5092
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3487
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
771
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.