• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Request to the moderator

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The FAQ section is actually a Wiki, so you can add any questions and answers you see fit yourself.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Do Re Mi Fa So La Tiny Ad
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic