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("BOD Y " + Article.ToStrin g() + "\r\n");
// this line reads stream till line with period only
s = nntp1.Receive(" .\r\n");
Stream inMemStream, outMemStream;
inMemStream= new MemoryStream(En coding.UTF8.Get Bytes(s));
outMemStream= new MemoryStream();
inMemStream.See k(0, 0);
yenc.DecodeFrom RawStream(inMem Stream, outMemStream);
outMemStream.Se ek(0, 0);
StreamReader sr = new StreamReader(ou tMemStream, Encoding.UTF8);
string ArticleAttachme nt = 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 5 1752
"Armin Zingler" <az*******@free net.de> wrote in message news:<eP******* *******@TK2MSFT NGP09.phx.gbl>. .. "Marvin Grill" <ma*********@ho tmail.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
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 yEncInvalidForm atException("Th ere 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.BlockCop y(O,0,Out,0,cou nt);
return Out;
}
return null;
}
"Marvin Grill" <ma*********@ho tmail.com> wrote in message
news:f0******** *************** ***@posting.goo gle.com... 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("BOD Y " + Article.ToStrin g() + "\r\n"); // this line reads stream till line with period only s = nntp1.Receive(" .\r\n"); Stream inMemStream, outMemStream; inMemStream= new MemoryStream(En coding.UTF8.Get Bytes(s)); outMemStream= new MemoryStream(); inMemStream.See k(0, 0); yenc.DecodeFrom RawStream(inMem Stream, outMemStream); outMemStream.Se ek(0, 0);
StreamReader sr = new StreamReader(ou tMemStream, Encoding.UTF8); string ArticleAttachme nt = 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
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******* ******@TK2MSFTN GP11.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 yEncInvalidForm atException("Th ere 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.BlockCop y(O,0,Out,0,cou nt); return Out; } return null; } "Marvin Grill" <ma*********@ho tmail.com> wrote in message news:f0******** *************** ***@posting.goo gle.com... 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("BOD Y " + Article.ToStrin g() + "\r\n"); // this line reads stream till line with period only s = nntp1.Receive(" .\r\n"); Stream inMemStream, outMemStream; inMemStream= new MemoryStream(En coding.UTF8.Get Bytes(s)); outMemStream= new MemoryStream(); inMemStream.See k(0, 0); yenc.DecodeFrom RawStream(inMem Stream, outMemStream); outMemStream.Se ek(0, 0);
StreamReader sr = new StreamReader(ou tMemStream, Encoding.UTF8); string ArticleAttachme nt = 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
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*********@ho tmail.com> wrote in message
news:f0******** *************** ***@posting.goo gle.com... 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******* ******@TK2MSFTN GP11.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 yEncInvalidForm atException("Th ere 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.BlockCop y(O,0,Out,0,cou nt); return Out; } return null; } "Marvin Grill" <ma*********@ho tmail.com> wrote in message news:f0******** *************** ***@posting.goo gle.com... 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("BOD Y " + Article.ToStrin g() + "\r\n"); // this line reads stream till line with period only s = nntp1.Receive(" .\r\n"); Stream inMemStream, outMemStream; inMemStream= new MemoryStream(En coding.UTF8.Get Bytes(s)); outMemStream= new MemoryStream(); inMemStream.See k(0, 0); yenc.DecodeFrom RawStream(inMem Stream, outMemStream); outMemStream.Se ek(0, 0);
StreamReader sr = new StreamReader(ou tMemStream, Encoding.UTF8); string ArticleAttachme nt = 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 on sourceforge etc. with
multiple different posts and I keep getting the same problem - the post I'm
trying to decode has an encoded JPG file (a film poster for Kill Bill 2)
which the yEnc tools like yEnc.EXE manage to decode and encode fine, but...
|
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 on sourceforge etc. with
multiple different posts and I keep getting the same problem - the post I'm
trying to decode has an encoded JPG file (a film poster for Kill Bill 2)
which the yEnc tools like yEnc.EXE manage to decode and encode fine, but...
|
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 on sourceforge etc. with
multiple different posts and I keep getting the same problem - the post I'm
trying to decode has an encoded JPG file (a film poster for Kill Bill 2)
which the yEnc tools like yEnc.EXE manage to decode and encode fine, but...
|
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 have changed the
encoding on mine and that didn't work and then I tried the only 2 open
source ones I can Find. It is driving me nuts.
|
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
results unexpected:
import yenc, sys
fd1=open(sys.argv,'r')
#yenc.encode(sys.argv,"outfile.yenc",bytes=0)
yenc.decode(sys.argv,"outfile.mid",bytes=0,crc_in='')
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |