?
Solved

semicolon dissapears when writing to database

Posted on 2004-08-26
10
Medium Priority
?
293 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 500 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 500 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
Independent Software Vendors: 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

Industry Leaders: 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!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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