Answer the question
In order to leave comments, you need to log in
TEXTAREA-> JSON -> PHP -> MySQL -> PHP -> JSON -> TEXTAREA?
Hello!
Suppose the user enters data in TEXTAREA, then this data is sent using AJAX (JQuery) in JSON format to a PHP script, which in turn saves this data in the MySQL database.
Then, when working with a web application, a person can re-request this data through the same chain back to the textarea.
The question is that a lot of problems arise with "problem" characters: quotes and line breaks (in Javascript). Is there any universal solution that allows you not to lose a single character in this chain, not to cause errors anywhere and return the text saved on the server in its original form?
I tried to save the string in escape, but there is still a problem with quotes, when the quote is at the end - it is cut off.
utf-8 encoding everywhere.
Can you please tell me the best solution or give a link where you can read about it?
Answer the question
In order to leave comments, you need to log in
You did something wrong, I always encode such data with encodeURIComponent and there were no problems. Although if everything is so bad for you, get yourself a dictionary with problematic symbols and replace them with your hands.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question