Solved

semicolon dissapears when writing to database

Posted on 2004-08-26
10
281 Views
Last Modified: 2010-03-31
Hi,

I have a problem with dissapearing semicolons.
I have a String that looks like this:
update CLASSIFICATION set  text = "Drimel;dramel" where id = 4;

that I encode with URLEncoder.encode( string )

after it´s encoded the string looks like this:
&type=sql&data=update+CLASSIFICATION+set++text+%3D+%22Drimel%3Bdramel

I post it to a cgi-script but when it reaches the database it looks like this
Drimeldramel
so the semicolon have dissapeared. I cant find where its done. Does anyone know if there is another way of encoding the string?
Is it something special with the semicolon?

0
Comment
Question by:otroligafredde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 12

Expert Comment

by:Giant2
ID: 11900906
your semicolon is:
%3B

It's not disappeared.
0
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 11900915
looks like the cgi script is stripping it out for some reason :-(

I guess it is stripping it out to prevent SQL Injection...  do you have access to the cgi-script?  Can you rewrite the function it performs in Java (using PreparedStatement) ?
0
 
LVL 12

Assisted Solution

by:Giant2
Giant2 earned 125 total points
ID: 11900917
>I post it to a cgi-script
It's the decode of this script that made disappeareing your semicolon.
Check it.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:TimYates
ID: 11900920
> It's not disappeared.

It has in the database, according to this line:

> I post it to a cgi-script but when it reaches the database it looks like this
> Drimeldramel
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11900931
>> It's not disappeared.
>It has in the database, according to this line:
>
>> I post it to a cgi-script but when it reaches the database it looks like this
>> Drimeldramel

I continue the posting (at the same time you put your) see before, TimYates.
:)
0
 
LVL 21

Expert Comment

by:MogalManic
ID: 11901103
Try this experiment:
  1) construct the URL like this:
     &type=sql&data=update CLASSIFICATION set  text = "Drimel;dramel" where id = 4;&otherData=xxx
  2) Post the results to your CGI script.

Does the CGI script recieve the statement correctly?  If so, then the CGI-script does not know how to decode encoded strings!
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11901169
> If so, then the CGI-script does not know how to decode encoded strings!

It must know how to decode encoded strings, as it gets the "=" and the "'" chars...
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12249533
I reckon we were right...  Oh well :-)
0
 
LVL 3

Author Comment

by:otroligafredde
ID: 12257039
I´m very sorry that it took forever to accept the answers. I wish that I could blame it on something really big, like that a
tornado swept sweden away for a few months or something, but I can´t.

Thanks anyway for all the help.

/Fredrik
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
check java version using powershell 13 455
ejb entity bean example 2 56
ejb entity bean example issue 2 43
Selenium WebElement Login button findElement 9 14
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question