简体   繁体   中英

How to handle special characters in DB mysql

I am using MySQL Server Management Studio, Jsp, Java, Js. I have issue with displaying correctly the data I get from DB.

I have store some text with open and close quotation, and it does not display correctly on my jsp page. Eg:

A STUDY OF THE CASE OF BENJAMIN BUTTON "BY ARTHUR C CLARKE"

Displayed as :
A STUDY OF THE CASE OF BENJAMIN BUTTON  ARTHUR C 
"BY CLARKE"

I wonder do I need to wrap the query result with something when I get from the DB or do I need to insert into DB like (\\"), but below does not work, also I notice single quotation mark(') also have similar issue :

A STUDY OF THE CASE OF BENJAMIN BUTTON \"BY ARTHUR C CLARKE\"

could you include some parts of your code please? it would be hard to find out what's the problem just by description. however if it was me i would try the following solutions:

1-like Tim Biegeleisen said, check if you see the correct string.

2-i know it might sound weird but once i had the same problem and i converted the string to byte and then add that to db in a temporary table just to see if there was any problem with any character in my string.(I was surprised that it worked for me and found the problem :) )

3- check out this other question you might get the answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM