Binary to ASCII

Discussion in 'C Programming' started by Wrecked, May 17, 2006.

  1. Wrecked

    Wrecked Guest

    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.
     
    Wrecked, May 17, 2006
    #1
    1. Advertising

  2. 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)
     
    Richard Heathfield, May 17, 2006
    #2
    1. Advertising

  3. Wrecked

    Wrecked Guest

    thanks for that.. but is that the best we could get.. since i will have
    to transmit data via SMS, memory is bit constraint
     
    Wrecked, May 17, 2006
    #3
  4. Wrecked

    Ico Guest

    Wrecked <> 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
     
    Ico, May 17, 2006
    #4
  5. Wrecked

    Jordan Abel Guest

    On 2006-05-17, Ico <> wrote:
    > Wrecked <> 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.
    >
    >
     
    Jordan Abel, May 17, 2006
    #5
  6. Wrecked

    Vladimir Oka Guest

    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 telecommunications 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 telecommunications 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 telecommunications 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>
     
    Vladimir Oka, May 17, 2006
    #6
  7. Wrecked

    Vladimir Oka Guest

    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.
     
    Vladimir Oka, May 17, 2006
    #7
  8. 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.
     
    Ben Bacarisse, May 17, 2006
    #8
  9. Wrecked

    Barry Guest

    "Vladimir Oka" <> wrote in message
    news:...
    >
    > 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 telecommunications 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 telecommunications 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 telecommunications 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.
     
    Barry, May 17, 2006
    #9
  10. Wrecked

    Vladimir Oka Guest

    Barry wrote:
    >
    > You need to develop a consistent method of replying to off
    > topic subjects.


    It would become too boring.
     
    Vladimir Oka, May 18, 2006
    #10
  11. Wrecked

    Guest

    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.


    yEnc? http://en.wikipedia.org/wiki/YEnc
    ASCII85? http://en.wikipedia.org/wiki/Ascii85
     
    , May 18, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Schellens
    Replies:
    8
    Views:
    3,022
    John Harrison
    Jul 15, 2003
  2. TOXiC
    Replies:
    5
    Views:
    1,260
    TOXiC
    Jan 31, 2007
  3. James O'Brien
    Replies:
    3
    Views:
    255
    Ben Morrow
    Mar 5, 2004
  4. Alextophi
    Replies:
    8
    Views:
    518
    Alan J. Flavell
    Dec 30, 2005
  5. bruce
    Replies:
    38
    Views:
    280
    Mark Lawrence
    Nov 1, 2013
Loading...

Share This Page