Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Anyway to uuencode and uudecode a string in C++

111 views
Skip to first unread message

kushal bhattacharya

unread,
Aug 9, 2017, 5:06:09 AM8/9/17
to
Hi,
Is there any way to uuencode and uudecode via either the standard C++ library or some external libraries?Please point me out some valuable pointers here.
Thanks

Scott Lurndal

unread,
Aug 9, 2017, 8:41:35 AM8/9/17
to

Jorgen Grahn

unread,
Aug 9, 2017, 8:47:43 AM8/9/17
to
On Wed, 2017-08-09, kushal bhattacharya wrote:
> Hi,

> Is there any way to uuencode and uudecode via either the standard
> C++ library or some external libraries?

It's not in the standard library. You have to google for more info
... I'm not sure any major library has bothered to implement it, but
you can probably copy an implementation from some source code with a
license which permits that.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

kushal bhattacharya

unread,
Aug 9, 2017, 8:56:19 AM8/9/17
to
thanks for the info :) so is there any difference between normal encoding and the uuencode format?

Öö Tiib

unread,
Aug 9, 2017, 9:10:29 AM8/9/17
to
On Wednesday, 9 August 2017 12:06:09 UTC+3, kushal bhattacharya wrote:
> Hi,
> Is there any way to uuencode and uudecode via either the standard C++
> library or some external libraries?

Not in standard library. These are simple functions and posix commands.
http://www8.cs.umu.se/~isak/snippets/uuencode.c
http://www8.cs.umu.se/~isak/snippets/uudecode.c

> Please point me out some valuable pointers here.

Usually it is Base64 encoding what is used to transfer binary bits
as text these days (and not uu encoding). When something
archaic is tried to be used then on at least 90% of cases it is some
cargo cult misuse because of misunderstanding of random text
that was read in internet. How is it on your case?

Öö Tiib

unread,
Aug 9, 2017, 10:01:37 AM8/9/17
to
On Wednesday, 9 August 2017 15:56:19 UTC+3, kushal bhattacharya wrote:
> On Wednesday, August 9, 2017 at 6:17:43 PM UTC+5:30, Jorgen Grahn wrote:
> > On Wed, 2017-08-09, kushal bhattacharya wrote:
> > > Hi,
> >
> > > Is there any way to uuencode and uudecode via either the standard
> > > C++ library or some external libraries?
> >
> > It's not in the standard library. You have to google for more info
> > ... I'm not sure any major library has bothered to implement it, but
> > you can probably copy an implementation from some source code with a
> > license which permits that.
>
> thanks for the info :) so is there any difference between normal encoding
> and the uuencode format?

What is "normal encoding"? The encoding of "normals" of 3D space or in
floating point have nothing to do with uuencode format.

kushal bhattacharya

unread,
Aug 10, 2017, 3:38:38 AM8/10/17
to
On Wednesday, August 9, 2017 at 2:36:09 PM UTC+5:30, kushal bhattacharya wrote:

> What is "normal encoding"? The encoding of "normals" of 3D space or in
floating point have nothing to do with uuencode format.

ok thanks no i meant i am confused about the base 64 encoding format and all the other encoding formats out there is there any signficant difference among them?

Kalle Olavi Niemitalo

unread,
Aug 10, 2017, 4:24:00 AM8/10/17
to
kushal bhattacharya <bhattachar...@gmail.com> writes:

> ok thanks no i meant i am confused about the base 64 encoding
> format and all the other encoding formats out there is there
> any signficant difference among them?

Sure, there are differences in
* how pleased a programmer will be to hear that they must use
this encoding format to interface with your system
* how widely the encoding format is supported in libraries for
various programming languages
* which characters can occur in the encoded text; this affects
how likely the data is to get corrupted if processed by
programs intended for text, and whether it can be embedded
as is in data formats that reserve some characters (like
URIs or XML)
* how long the encoded text becomes
* whether metadata such as file names can be encoded
* whether there is a checksum (as in yEnc)
* whether the implementation needs division and multiplication
operations (as in Ascii85), or just bit shifts and small lookup
arrays

Jorgen Grahn

unread,
Aug 10, 2017, 9:49:44 AM8/10/17
to
On Wed, 2017-08-09, kushal bhattacharya wrote:
> On Wednesday, August 9, 2017 at 6:17:43 PM UTC+5:30, Jorgen Grahn wrote:
>> On Wed, 2017-08-09, kushal bhattacharya wrote:
>> > Hi,
>>
>> > Is there any way to uuencode and uudecode via either the standard
>> > C++ library or some external libraries?
>>
>> It's not in the standard library. You have to google for more info
>> ... I'm not sure any major library has bothered to implement it, but
>> you can probably copy an implementation from some source code with a
>> license which permits that.
>
> thanks for the info :) so is there any difference between normal
> encoding and the uuencode format?

Check Wikipedia, like I did. There's a whole table of different ways
to encode binary data as text. Base64 is one of the most common ones,
and maybe the one you're thinking of as normal.

https://en.wikipedia.org/wiki/Binary-to-text_encoding#Encoding_standards

Yes, there are differences.

kushal bhattacharya

unread,
Aug 11, 2017, 1:44:06 AM8/11/17
to
My main concern is to send huge strings via socket which may include any special character so my major concern would be to preserver all those strings on the other side of the recieving socket too.So thats whyi would prefer some good encoding mechanism here

Öö Tiib

unread,
Aug 11, 2017, 2:35:58 AM8/11/17
to
Goodness is not universal. Otherwise everybody would use same encoding
for everything. It can depend on lot of factors like who will make the things
involved, what is at these sides, what sort of data is sent and over what
kind of channel and what are priorities of capabilities (like average
/worst latency and throughput) of result.

One thing in software development is to realize that we do not carve
our software into rock. So if we do not know what to choose then we can
make arbitrary pick what is simplest for us right now and change it
later when we become more aware of situation.

kushal bhattacharya

unread,
Aug 11, 2017, 2:39:49 AM8/11/17
to
thanks for the time being i am choosing base 64 encoding :)

Ian Collins

unread,
Aug 11, 2017, 4:39:39 AM8/11/17
to
On 08/11/17 05:43 PM, kushal bhattacharya wrote:
> On Wednesday, August 9, 2017 at 6:40:29 PM UTC+5:30, Öö Tiib wrote:
>> On Wednesday, 9 August 2017 12:06:09 UTC+3, kushal bhattacharya
>> wrote:
>>> Hi, Is there any way to uuencode and uudecode via either
>>> the standard C++ library or some external libraries?
>>
>> Not in standard library. These are simple functions and posix
>> commands. http://www8.cs.umu.se/~isak/snippets/uuencode.c
>> http://www8.cs.umu.se/~isak/snippets/uudecode.c
>>
>>> Please point me out some valuable pointers here.
>>
>> Usually it is Base64 encoding what is used to transfer binary bits
>> as text these days (and not uu encoding). When something archaic is
>> tried to be used then on at least 90% of cases it is some cargo
>> cult misuse because of misunderstanding of random text that was
>> read in internet. How is it on your case?

[please wrap!]

> My main concern is to send huge strings via socket which may
> include any special character so my major concern would be to
> preserver all those strings on the other side of the recieving
> socket too.So thats whyi would prefer some good encoding mechanism
> here

Sockets are typically used to transfer binary data, why do you see
special characters as a problem?

--
Ian

kushal bhattacharya

unread,
Aug 11, 2017, 5:26:10 AM8/11/17
to
I am sending data from my c++ program to php and i am using it to show it to the browser so the browser ,to my opinion may misnterpret or cant recognise some character

Paavo Helde

unread,
Aug 11, 2017, 3:16:54 PM8/11/17
to
It looks like you are having troubles with different text encodings.
This has nothing to do with sockets, uuencode or base64.

Suggesting to convert all textual data into UTF-8 at the first
possibility and ensure that all produced HTML pages have the correct
UTF-8 charset declaration.

hth
Paavo





kushal bhattacharya

unread,
Aug 12, 2017, 12:55:01 AM8/12/17
to
as in the base 64 spec it states that the encoding format is used for transport preservation purposes used mainly in mail systems

Jorgen Grahn

unread,
Aug 12, 2017, 3:14:13 AM8/12/17
to
On Fri, 2017-08-11, Ian Collins wrote:
> On 08/11/17 05:43 PM, kushal bhattacharya wrote:
...
>> My main concern is to send huge strings via socket which may
>> include any special character so my major concern would be to
>> preserver all those strings on the other side of the recieving
>> socket too.So thats whyi would prefer some good encoding mechanism
>> here
>
> Sockets are typically used to transfer binary data,

That could be misinterpreted; lots of common protocols use text.
But yes, e.g. a TCP socket has always been two streams of bytes.

> why do you see special characters as a problem?

I think his problem is really about protocol design. If he wants to
do more than send a single string over a single TCP socket, with no
verification, then he has to do something, e.g. send a content-length
like HTTP does, or define an end marker (and escape it in the data)
like SMTP does.

Paavo Helde

unread,
Aug 12, 2017, 4:46:33 PM8/12/17
to
Yes, for transport via e-mail systems ca 30 years ago. So tell me again
why your C++ data is sent to PHP via 30-year old e-mail systems?

Cheers
Paavo



kushal bhattacharya

unread,
Aug 13, 2017, 2:45:22 AM8/13/17
to
Actually i dont have much idea about encoding as somone pointed out in this post to start with a random and simplest encoding format which is well supported by nearlly all programming languages and i am using this because i have to send huge strings via socket to remote servers and there may be chance of misinterpretitions in between so to me encoding data would preserve the strings in the orginal form on either end of transport

Öö Tiib

unread,
Aug 13, 2017, 7:07:08 AM8/13/17
to
Perhaps in manner as it always tends to be with silly PHP.
https://xkcd.com/327/

Paavo Helde

unread,
Aug 13, 2017, 3:49:01 PM8/13/17
to
On 13.08.2017 9:45, kushal bhattacharya wrote:
>
> Actually i dont have much idea about encoding as somone pointed out in this post to start with a random and simplest encoding format which is well supported by nearlly all programming languages and i am using this because i have to send huge strings via socket to remote servers and there may be chance of misinterpretitions in between so to me encoding data would preserve the strings in the orginal form on either end of transport

The question remains: why do you think that the sockets ruin your huge
strings somehow? Why not small strings, for example? And why do they not
ruin the terabytes of youtube videos downloaded every day, for that
matter? Have the Sockets declared some kind of personal vendetta on you?




kushal bhattacharya

unread,
Aug 16, 2017, 4:37:24 AM8/16/17
to
No no i am not talking about ruining any thing as a simple transport but suppose an intermediate person somehow gets access do to this data ,then if no encoding is there there may be such that the data may get modified

kushal bhattacharya

unread,
Aug 16, 2017, 4:48:36 AM8/16/17
to
https://stackoverflow.com/questions/201479/what-is-base-64-encoding-used-for


Please refer to the answer of this link i think this validates my point of using an encoding format here

Ian Collins

unread,
Aug 16, 2017, 6:01:50 AM8/16/17
to
The answer specifically mentions "some protocols may interpret your
binary data as control characters". You said you were using a direct
socket connection, no additional protocols. The introductory paragraph
in the answer is wrong for many situations where data *is* transferred
by just streaming the data over the wire in a raw format.

--
Ian

kushal bhattacharya

unread,
Aug 16, 2017, 6:17:08 AM8/16/17
to
Actually later there may be usage of some additional protocols via the sockets so this is just a preliminary test phase going on
0 new messages