Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Request to the moderator  RSS feed

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution my self
I request the author of this site must keep this as a FAQ's in JDBC section

This problem is the most frequesnt one.

I am explaining it again
when ever we copy the data from microsoft word document to Textarea of HTML page then the single Quotes(') and double Quotes (") will be changed to some other ASCII char
so, In the servlet we take the request from the user using String

data=request.getParameter("textarea");
char ch1=(char)146;//here 146 is the ASCII code of singleQuote(singlequote of ms word not an actual single quote)

char ch[] =new char[]{ch1};
StringBuffer sb1=new StringBuffer();
String token=new String(ch);
StringTokenizer st1 = new StringTokenizer(data,token);
while(st1.hasMoreTokens())
{
sb1.append(st1.nextToken() +"\'");
}
System.out.println(sb1.toString());//here it diplays actual single quote

after getting the actual single quote we can then insert the data into database(table).


In the same way we need to convert the doubleQuote with it's ASCII code.


I hope you will accept my request.


Thanking you sir,

regards,
cinux
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FAQ section is actually a Wiki, so you can add any questions and answers you see fit yourself.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the JDBC FAQ is a wikki, which (braodly speaking) means you are welcome to go there and update the section with the entry your self!

Happy typing!

Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!