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 1738
"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...
|
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...
|
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...
|
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)...
| |
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
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: 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...
| |