Your question is a fine collection of confusions. You managed to confuse everything.
Let's try to sort it out.
Using PHP, what is the best way to store special characters (like the following) in a MSQUL database, to avoid injections.
These are incomparable matters. Storing special chars is one matter and avoiding injections is another. completely different one.
$book_text=htmlentities($book_text, "ENT_QUOTES");
this is most funny part. although it is intended to protect your queries, it's actually does nothing. Because instead of constant ENT_QUOTES which value is 3 you are using string ENT_QUOTES which numeric value is 0, so, you are setting no flag.
But even if you set this flag correctly, it won't automatically protect you. Because an injection code may contain no special chars.
To avoid injections, you have to follow whole set of rules, not one simple function "make_my_data_safe()". There is no magic wand.
See this my answer for the details.
As for the specialchars, it's simple. The only problem that there are NO solid special chars set. There are different special chars for the different environments.
- ' have meaning for the database and HTML
- <> have meaning for the HTML only
- é à ù have meaning for the HTML only, depends on the encoding.
you have you use different formatting rules for the every case. Different, not a single one for all.
to use é à ù chars with HTML you have to set proper HTTP header.
to use é à ù with database you have to set your table encoding to utf8 and connection encoding to utf 8.