Base64 Problem

encoding is working well and decoding without origional shape. please check my code and help me. thanks

Origional:

this is

the first

encode/decode

example

Encoded:

dGhpcyBpcyANCnRoZSBmaXJzdA0KZW5jb2RlL2RlY29kZQ0KZXhhbXBsZQ==

Decoded:

this is the first encode/decode example

<!--file1.java>

String desc2=req.getParameter(揹esc2?;

String encodedString = Base64.encode(desc2);

PreparedStatement ps = cnn.prepareStatement(搃nsert into aa(desc2) values (?)?;

ps.setString(1, encodedString);

ps.executeUpdate();

ps.close();

<!--file2.java>

desc2=rs.getString("desc2");

byte[] decodedBytes = Base64.decode(desc2);

String decodedString =new String(decodedBytes);

out.println(decodedString);

[921 byte] By [Javahlpa] at [2007-11-26 21:26:24]
# 1
Edit: Nevermind. Missed the "getParameter" somehow.
masijade.a at 2007-7-10 3:06:51 > top of Java-index,Java Essentials,New To Java...
# 2
> Edit: Nevermind. Missed the "getParameter" somehow.nopes, this is not the problem and I mentioned the req.getParameter in file1.java if you read the code pleasethanks for your reply
Javahlpa at 2007-7-10 3:06:51 > top of Java-index,Java Essentials,New To Java...
# 3
@op: when I use com.sun.org.apache.xml.internal.security.utils.Base64everything decodes as expected. I suspect it's a quirck in your Base64en/decoder (the encoding is correct).kind regards,Jos
JosAHa at 2007-7-10 3:06:51 > top of Java-index,Java Essentials,New To Java...
# 4

The actual string you are encoding isString value = "this is \r\n"+

"the first\r\n"+

"encode/decode\r\n"+

"example";

which I get from decoding you encoded value using my own Base64 decoder and the sun.misc one. As Jos says but without the profanity, your decoder is f******.

sabre150a at 2007-7-10 3:06:51 > top of Java-index,Java Essentials,New To Java...
# 5

> > Edit: Nevermind. Missed the "getParameter"

> somehow.

>

> nopes, this is not the problem and I mentioned the

> req.getParameter in file1.java if you read the code

> please

>

> thanks for your reply

Before you get snotty, you will notice that entire post is an edit, erasing the original post. The edit says to nevermind the original post because I overlooked the getParameter in your code somehow, not because you didn't use it.

masijade.a at 2007-7-10 3:06:51 > top of Java-index,Java Essentials,New To Java...
# 6

> Before you get snotty, you will notice that entire

> post is an edit, erasing the original post. The edit

> says to nevermind the original post because I

> overlooked the getParameter in your code somehow, not

> because you didn't use it.

please don't get "Parameter" issue seriously and let me know the solution if you can

Javahlpa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 7
You were given the solution already. Use a different Base64 encoder/decoder.
masijade.a at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 8

> @op: when I use

> com.sun.org.apache.xml.internal.security.utils.Base64

> everything decodes as expected. I suspect it's a

> quirck in your Base64

> en/decoder (the encoding is correct).

Can you please get me the url to download with examples

thanks & regards

Javahlpa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 9

> Can you please get me the url to download with examples

>

> thanks & regards

You're welcome of course; that Base64 class was on my build path

by sheer serendipity; here's another [url=http://www.source-code.biz/snippets/java/2.htm]link[/url].

kind regards,

Jos

JosAHa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 10
Thanks Jos I downloaded the the package that contains 4 java files and compiled. can you please change my first posted code according to these filesthanks
Javahlpa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 11
> Thanks Jos I downloaded the the package that contains> 4 java files and compiled. can you please change my> first posted code according to these files> > thanksWould you like some fries with that?
warnerjaa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 12
> Would you like some fries with that?Actually there is no example with this package and when am compiling the same code its giving errorsso please help me to solve this issuethanks & regards
Javahlpa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 13
> Thanks Jos I downloaded the the package that contains 4 java files > and compiled. can you please change my first posted code according > to these filesThere are proper API docs available from that link you know ...kind regards,Jos
JosAHa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 14
> There are proper API docs available from that link> you know ...I am unable to find the api docs on the page
Javahlpa at 2007-7-10 3:06:52 > top of Java-index,Java Essentials,New To Java...
# 15
Sorry Jos I found the API's thanks & regards
Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 16
See reply #7 in http://forum.java.sun.com/thread.jspa?threadID=5148690&tstart=0 .
sabre150a at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 17
> See reply #7 in> http://forum.java.sun.com/thread.jspa?threadID=5148690> &tstart=0 .Sabre150: Your are doing good work. Keep it on and see that for the last two weeks java professionals are not able to solve my problemkeep it up
Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 18

> > See reply #7 in

> >

> http://forum.java.sun.com/thread.jspa?threadID=5148690

>

> > &tstart=0 .

>

> Sabre150: Your are doing good work. Keep it on and

> see that for the last two weeks java professionals

> are not able to solve my problem

That is not at all fair on the forum members. You presented the problem as a Base64 problem but it has nothing at all to do with Base64. It is an HTML problem.

sabre150a at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 19
> That is not at all fair on the forum members. You> presented the problem as a Base64 problem but it has> nothing at all to do with Base64. It is an HTML> problem.if this is HTML problem correct it. don't make answers in air
Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 20

> > That is not at all fair on the forum members. You

> > presented the problem as a Base64 problem but it

> has

> > nothing at all to do with Base64. It is an HTML

> > problem.

>

> if this is HTML problem correct it. don't make

> answers in air

YOU have to learn HTML! I don't know how you want to present the text so I don't know what tags you need. This is a Java forum and not an HTML forum and even if it was an HTML forum you can't demand we do anything!

You need to fucking read some manuals!

sabre150a at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 21

> > That is not at all fair on the forum members. You presented the

> > problem as a Base64 problem but it has nothing at all to do with

> > Base64. It is an HTML problem.

>

> if this is HTML problem correct it. don't make answers in air

Didn't your mother ever teach you to say "please" when you're asking

someone to do you a favour?

kind regards,

Jos

JosAHa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 22

> > > That is not at all fair on the forum members.

> You

> > > presented the problem as a Base64 problem but it

> > has

> > > nothing at all to do with Base64. It is an HTML

> > > problem.

> >

> > if this is HTML problem correct it. don't make

> > answers in air

>

> YOU have to learn HTML! I don't know how you

> want to present the text so I don't know what tags

> you need. This is a Java forum and not an HTML forum

> and even if it was an HTML forum you can't demand we

> do anything!

>

> You need to fucking read some manuals!

Actually you didn't get my problem exactly even you didn't read the postings that what I need but just to showing off by replying just for none

first read my first postings and then come to discuss

Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 23

fucking read some manuals!

>

>

> Actually you didn't get my problem exactly even you

> didn't read the postings that what I need but just to

> showing off by replying just for none

>

> first read my first postings and then come to discuss

You are a piece of ungrateful sh1t! I had to guess what your real problem was because you seemed determined that it was a Base64 problem when it was nothing to do with Base64.

Go to hell!

sabre150a at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 24

> Sabre150: Your are doing good work. Keep it on and

> see that for the last two weeks java professionals

> are not able to solve my problem

Please do excuse me for assuming that someone who was writing Java code in a JSP, and trying to encode and decode Base64, would have the basic web knowledge that is required to know that a newline character in a web page would not automatically translate to a

tag, and cause a new line to appear in the web page. I mean, after all, that is HTML, and has absolutely nothing to do with Java web programming.

You, sir, are truly the lowest common denominator among the Java web people.

The fact that you have the audacity to berate me for trying to help you absolutely floors me. You'll go far in your career.

kevjavaa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 25

KevJava and Sabre150:

You have not read my first post and talking a lot just for none.

Please read my post that when am inserting data into oracle db it encodes well but when am decoding to display from my db it doesn't decode in origional shape from db.

this is my problem

Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 26

> KevJava and Sabre150:

> You have not read my first post and talking a lot

> just for none.

>

> Please read my post that when am inserting data into

> oracle db it encodes well but when am decoding to

> display from my db it doesn't decode in origional

> shape from db.

>

> this is my problem

You problem seems to be that empty void between your two ears.

Aknibbsa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 27

> KevJava and Sabre150:

> You have not read my first post and talking a lot

> just for none.

>

> Please read my post that when am inserting data into

> oracle db it encodes well but when am decoding to

> display from my db it doesn't decode in origional

> shape from db.

>

> this is my problem

You are an obstinate twit. That might be because the first post of your [url=http://forum.java.sun.com/thread.jspa?threadID=5148690&tstart=0]cross-post[/url] didn't mention an oracle database.

kevjavaa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 28

> You are an obstinate twit. That might be because the

> first post of your

> [url=http://forum.java.sun.com/thread.jspa?threadID=51

> 48690&tstart=0]cross-post[/url] didn't mention an

> oracle database.

and what about you? even you don't know in which thread you are replying!!you are talking in http://forum.java.sun.com/thread.jspa?threadID=5147584

Where are you?

Javahlpa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 29

> > You are an obstinate twit. That might be because

> the

> > first post of your

> >

> [url=http://forum.java.sun.com/thread.jspa?threadID=51

>

> > 48690&tstart=0]cross-post[/url] didn't mention an

> > oracle database.

>

> and what about you? even you don't know in which

> thread you are replying!!you are talking in

> http://forum.java.sun.com/thread.jspa?threadID=5147584

>

> Where are you?

Good job junior wait to bite the hand that feeds you.

Aknibbsa at 2007-7-21 18:17:25 > top of Java-index,Java Essentials,New To Java...
# 30

> KevJava and Sabre150:

> You have not read my first post and talking a lot

> just for none.

I read it several times.

>

> Please read my post that when am inserting data into

> oracle db it encodes well but when am decoding to

> display from my db it doesn't decode in origional

> shape from db.

But you did not say you were displaying it through a JSP!

>

> this is my problem

Your problem is that you are an ignorant shite.

sabre150a at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 31
> Didn't your mother ever teach you to say "please"> when you're asking> someone to do you a favour?I sure taught his mother how to say "please" last night.Harharharhar!!Message was edited by: bckrispi
bckrispia at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 32

> and what about you? even you don't know in which

> thread you are replying!!you are talking in

> http://forum.java.sun.com/thread.jspa?threadID=5147584

>

>

> Where are you?

Wow. I really wish there was an "Ignore" or "Label as twit" feature on this board now.

kevjavaa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 33
> Wow. I really wish there was an "Ignore" or "Label> as twit" feature on this board now.facing truth is very hard
Javahlpa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 34

> > Wow. I really wish there was an "Ignore" or

> "Label

> > as twit" feature on this board now.

>

> facing truth is very hard

Now you are just trolling. No person can be this stupid to misunderstand that and still have the ability to breath.

Aknibbsa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 35

> You are a piece of ungrateful sh1t! I had to

> guess what your real problem was because you seemed

> determined that it was a Base64 problem when it was

> nothing to do with Base64.

Unfortunately the OP first asked this question in the JDBC forum. (On the grounds that the data was being read from a database or something, I guess.) Some idiot suggested encoding the data with Base64, which to you or me is obviously ridiculous. But the OP seems bound and determined to do that anyway.

The problem is that the OP doesn't know anything. Now we have frustrated people answering the cross-posts all over the forum and getting nowhere because the OP doesn't have the background to understand any of the answers. Might as well just give it up.

DrClapa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 36

> > Didn't your mother ever teach you to say "please"

> > when you're asking someone to do you a favour?

>

> I sure taught his mother how to say "please" last night.

>

> Harharharhar!!

Men ... *sigh* ... they're all dawgs I'm telling ya! With their football and

sixpacks and leaving all their dirty clothes all over the place. Men never

grow up; *sigh* ...

kind regards,

Loretta

JosAHa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 37

> > > Didn't your mother ever teach you to say

> "please"

> > > when you're asking someone to do you a favour?

> >

> > I sure taught his mother how to say "please"

> last night.

> >

> > Harharharhar!!

>

> Men ... *sigh* ... they're all dawgs I'm telling ya!

> With their football and

> sixpacks and leaving all their dirty clothes all over

> the place. Men never

> grow up; *sigh* ...

>

> kind regards,

>

> Loretta

always said please but there is nobody who can favor

Javahlpa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 38

> Unfortunately the OP first asked this question in the

> JDBC forum. (On the grounds that the data was being

> read from a database or something, I guess.)

--

Its mean you didn't even seen the actual thread and came

>Some

> idiot suggested encoding the data with Base64, which

> to you or me is obviously ridiculous. But the OP

> seems bound and determined to do that anyway.

>

without knowing the actual problem you are saying your professional brothers ideot! how its pitty

> The problem is that the OP doesn't know anything. Now

> we have frustrated people answering the cross-posts

> all over the forum and getting nowhere because the OP

> doesn't have the background to understand any of the

> answers. Might as well just give it up.

without knowing anything you are just supposing everything and talking in the year

I regard all the professionals but request please please be polite

thanks

Javahlpa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 39
> thanksHere's a tip: create another account name because you certainly blewit with this one. I too found you quite demanding and quite unclear inyour problem descriptions (reread your own threads and see for yourself).kind regards,Jos
JosAHa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 40

> > thanks

>

> Here's a tip: create another account name because you

> certainly blew

> it with this one. I too found you quite demanding and

> quite unclear in

> your problem descriptions (reread your own threads

> and see for yourself).

>

> kind regards,

>

> Jos

I don't think there is any truer proof of trolldom than having gotten cross-ways with Jos :).

kevjavaa at 2007-7-21 18:17:30 > top of Java-index,Java Essentials,New To Java...
# 41
> I don't think there is any truer proof of trolldom> than having gotten cross-ways with Jos :).Don't pay any attention to me; I'm such a naive puppy ;-)kind regards,Jos
JosAHa at 2007-7-21 18:17:31 > top of Java-index,Java Essentials,New To Java...