473,405 Members | 2,300 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,405 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 20 '05 #1
7 1342
"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 20 '05 #2
Hey, you're not related to the 'George Foreman Grill' are you ?

OHM#

Marvin Grill wrote:
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 20 '05 #3
* ma*********@hotmail.com (Marvin Grill) scripsit:
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();


Seems to be C# code, that's OT in this group...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
"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 20 '05 #5
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 20 '05 #6
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 20 '05 #7
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 20 '05 #8

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

Similar topics

3
by: Freddie | last post by:
Hi, I posted a while ago for some help with my word finder program, which is now quite a lot faster than I could manage. Thanks to all who helped :) This time, I've written a basic batch...
5
by: Marvin Grill | last post by:
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...
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...
6
by: Scirious | last post by:
People, many of you may not know what yEnc is. To simplify, it is a methode to encode binary files very used in Usenet because it creates an overhead of only 2% when compare to 33%-40% of overhead...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.