473,386 Members | 1,779 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,386 software developers and data experts.

yEnc decoder

Hi, I'm working on a type of NewsHound program and am stuck on how to
decode the yEnc encoded articles (body).

I tried using Joe Feser's yEnc class but can't seem to get it to work
properly
Not sure whether it's an Encoding.Type problem or not getting the
stream start position right.

In any case here's part of the code with the problem:

__________________________________________________ _______________
Article = 21971499;
nntp1.Send("BODY " + Article.ToString() + "\r\n");
// this line reads stream till line with period only
s = nntp1.Receive(".\r\n");
Stream inMemStream, outMemStream;
inMemStream= new MemoryStream(Encoding.UTF8.GetBytes(s));
outMemStream= new MemoryStream();
inMemStream.Seek(0, 0);
yenc.DecodeFromRawStream(inMemStream, outMemStream);
outMemStream.Seek(0, 0);

StreamReader sr = new StreamReader(outMemStream, Encoding.UTF8);
string ArticleAttachment = sr.ReadToEnd();
__________________________________________________ ____________________

The problem is that the decoded string has only the upper case letters
right but the lower case letters are spaces.
If any one knows of any other components out there that can decode
yEnc please let me know.

Thanks
Marv
Nov 22 '05 #1
5 1724
"Marvin Grill" <ma*********@hotmail.com> schrieb
...


You know that you've also posted to the VB.NET group?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 22 '05 #2
"Armin Zingler" <az*******@freenet.de> wrote in message news:<eP**************@TK2MSFTNGP09.phx.gbl>...
"Marvin Grill" <ma*********@hotmail.com> schrieb
...


You know that you've also posted to the VB.NET group?


Yes Armin I realized that but I have a two-fold question. The second
part is asking for information on ANY components known that could do
yEnc decoding --- which can be written in either C# or VB

But thanks for your constructive criticism even though it did not help
with my question in any way what so ever.

Regards
Marvin Grill
Nov 22 '05 #3
If my memory serves right, this code should work(I wrote it a long time ago
and I don't know for sure if it was 100% working, I know it was working with
the test files):
byte[] yEncDecodeBlock(byte[] Block)
{
byte x;
byte[] O = new byte[Block.Length];
byte[] Out;
int count = 0;
for (int i=0;i < Block.Length; i++)
{
x = Block[i];
if (x=='\r')
{

i++;
if (Block[i] == '\n')
{
continue;
}
else
{
throw new yEncInvalidFormatException("There was a carriage return
without a linefeed detected");
}
}
else if (x=='=')
{
i++;
byte r = x;
x = Block[i];
O[count] = (byte)(x-64-42);
}
else
{
O[count] = (byte)(x-42);
}
count++;
}
if (count != 0)
{
Out = new byte[count];
Buffer.BlockCopy(O,0,Out,0,count);
return Out;
}
return null;
}
"Marvin Grill" <ma*********@hotmail.com> wrote in message
news:f0**************************@posting.google.c om...
Hi, I'm working on a type of NewsHound program and am stuck on how to
decode the yEnc encoded articles (body).

I tried using Joe Feser's yEnc class but can't seem to get it to work
properly
Not sure whether it's an Encoding.Type problem or not getting the
stream start position right.

In any case here's part of the code with the problem:

__________________________________________________ _______________
Article = 21971499;
nntp1.Send("BODY " + Article.ToString() + "\r\n");
// this line reads stream till line with period only
s = nntp1.Receive(".\r\n");
Stream inMemStream, outMemStream;
inMemStream= new MemoryStream(Encoding.UTF8.GetBytes(s));
outMemStream= new MemoryStream();
inMemStream.Seek(0, 0);
yenc.DecodeFromRawStream(inMemStream, outMemStream);
outMemStream.Seek(0, 0);

StreamReader sr = new StreamReader(outMemStream, Encoding.UTF8);
string ArticleAttachment = sr.ReadToEnd();
__________________________________________________ ____________________

The problem is that the decoded string has only the upper case letters
right but the lower case letters are spaces.
If any one knows of any other components out there that can decode
yEnc please let me know.

Thanks
Marv

Nov 22 '05 #4
Daniel thanks very much for your reply. You are the first person to
add anything intelligent to this thread so far. You are a gentleman.
I'll give it a try and post a reply for others to benefit.

Marv

"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:<OA*************@TK2MSFTNGP11.phx.gbl>...
If my memory serves right, this code should work(I wrote it a long time ago
and I don't know for sure if it was 100% working, I know it was working with
the test files):
byte[] yEncDecodeBlock(byte[] Block)
{
byte x;
byte[] O = new byte[Block.Length];
byte[] Out;
int count = 0;
for (int i=0;i < Block.Length; i++)
{
x = Block[i];
if (x=='\r')
{

i++;
if (Block[i] == '\n')
{
continue;
}
else
{
throw new yEncInvalidFormatException("There was a carriage return
without a linefeed detected");
}
}
else if (x=='=')
{
i++;
byte r = x;
x = Block[i];
O[count] = (byte)(x-64-42);
}
else
{
O[count] = (byte)(x-42);
}
count++;
}
if (count != 0)
{
Out = new byte[count];
Buffer.BlockCopy(O,0,Out,0,count);
return Out;
}
return null;
}
"Marvin Grill" <ma*********@hotmail.com> wrote in message
news:f0**************************@posting.google.c om...
Hi, I'm working on a type of NewsHound program and am stuck on how to
decode the yEnc encoded articles (body).

I tried using Joe Feser's yEnc class but can't seem to get it to work
properly
Not sure whether it's an Encoding.Type problem or not getting the
stream start position right.

In any case here's part of the code with the problem:

__________________________________________________ _______________
Article = 21971499;
nntp1.Send("BODY " + Article.ToString() + "\r\n");
// this line reads stream till line with period only
s = nntp1.Receive(".\r\n");
Stream inMemStream, outMemStream;
inMemStream= new MemoryStream(Encoding.UTF8.GetBytes(s));
outMemStream= new MemoryStream();
inMemStream.Seek(0, 0);
yenc.DecodeFromRawStream(inMemStream, outMemStream);
outMemStream.Seek(0, 0);

StreamReader sr = new StreamReader(outMemStream, Encoding.UTF8);
string ArticleAttachment = sr.ReadToEnd();
__________________________________________________ ____________________

The problem is that the decoded string has only the upper case letters
right but the lower case letters are spaces.
If any one knows of any other components out there that can decode
yEnc please let me know.

Thanks
Marv

Nov 22 '05 #5
Heh, np, hopefully it still works.
However, you should probably avoid posting so broadly, the general group
would probably have sufficed.
Also, you may want to obfusticate your email addy, there are a few nasty
scanners that will spam you with virii, etc using email addresses hulled
from these groups.
"Marvin Grill" <ma*********@hotmail.com> wrote in message
news:f0**************************@posting.google.c om...
Daniel thanks very much for your reply. You are the first person to
add anything intelligent to this thread so far. You are a gentleman.
I'll give it a try and post a reply for others to benefit.

Marv

"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message

news:<OA*************@TK2MSFTNGP11.phx.gbl>...
If my memory serves right, this code should work(I wrote it a long time ago and I don't know for sure if it was 100% working, I know it was working with the test files):
byte[] yEncDecodeBlock(byte[] Block)
{
byte x;
byte[] O = new byte[Block.Length];
byte[] Out;
int count = 0;
for (int i=0;i < Block.Length; i++)
{
x = Block[i];
if (x=='\r')
{

i++;
if (Block[i] == '\n')
{
continue;
}
else
{
throw new yEncInvalidFormatException("There was a carriage return
without a linefeed detected");
}
}
else if (x=='=')
{
i++;
byte r = x;
x = Block[i];
O[count] = (byte)(x-64-42);
}
else
{
O[count] = (byte)(x-42);
}
count++;
}
if (count != 0)
{
Out = new byte[count];
Buffer.BlockCopy(O,0,Out,0,count);
return Out;
}
return null;
}
"Marvin Grill" <ma*********@hotmail.com> wrote in message
news:f0**************************@posting.google.c om...
Hi, I'm working on a type of NewsHound program and am stuck on how to
decode the yEnc encoded articles (body).

I tried using Joe Feser's yEnc class but can't seem to get it to work
properly
Not sure whether it's an Encoding.Type problem or not getting the
stream start position right.

In any case here's part of the code with the problem:

__________________________________________________ _______________
Article = 21971499;
nntp1.Send("BODY " + Article.ToString() + "\r\n");
// this line reads stream till line with period only
s = nntp1.Receive(".\r\n");
Stream inMemStream, outMemStream;
inMemStream= new MemoryStream(Encoding.UTF8.GetBytes(s));
outMemStream= new MemoryStream();
inMemStream.Seek(0, 0);
yenc.DecodeFromRawStream(inMemStream, outMemStream);
outMemStream.Seek(0, 0);

StreamReader sr = new StreamReader(outMemStream, Encoding.UTF8);
string ArticleAttachment = sr.ReadToEnd();
__________________________________________________ ____________________

The problem is that the decoded string has only the upper case letters
right but the lower case letters are spaces.
If any one knows of any other components out there that can decode
yEnc please let me know.

Thanks
Marv

Nov 22 '05 #6

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

Similar topics

2
by: Phillip Hamlyn | last post by:
I'm trying to get a Yenc Decoding algorithm working but keep getting the same problem. I'm using data from the yenc test newsgroup and have tried the same thing with most of the example source code...
2
by: Phillip Hamlyn | last post by:
I'm trying to get a Yenc Decoding algorithm working but keep getting the same problem. I'm using data from the yenc test newsgroup and have tried the same thing with most of the example source code...
4
by: Phillip Hamlyn | last post by:
I'm trying to get a Yenc Decoding algorithm working but keep getting the same problem. I'm using data from the yenc test newsgroup and have tried the same thing with most of the example source code...
6
by: Extremest | last post by:
Does anyone know how to decode a yenc encoded file? I have created a decoder that seems to work great for text. Now i am trying to create another one for images and I can't get it to work. I...
2
by: John Savage | last post by:
I save posts from a midi music newsgroup, some are encoded with yenc encoding. This gave me an opportunity to try out the decoders in Python. The UU decoder works okay, but my YENC effort gives...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.