I have a PHP script reading from a MySQL database where teachers have entered narrative comments for students in association with their report card.
I made the mistake, perhaps, of allowing the PHP scripts to accept rich text format. That way, teachers could copy and paste tables of grades, entries from essays in Microsoft Word, etc. They wanted the formatting preserved.
When viewed in the editor it is fine. In the MySQL it is piled up with tags.
When I parse it using a PHP script to output to the screen for parents I run into bizarre formatting errors.
I get the following character where there should be blank spaces or apostrophes: ý
The code for example is as follows:
The output on one line looks like: "ýýýýýýýýýýý Fredýs writing has become smoother since August"
The HTML source code after it has been parsed to the HTML site looks like:
<p class="MsoNormal"><span lang="EN-GB"><span style="mso-tab-count:1">ýýýýýýýýýýý </span>Fredýs
writing has become smoother since August..<span style="mso-spacerun: yes">ý </span>
The MySQL as it appears in phpMyAdmin looks like:
<p class="MsoNormal"><span lang="EN-GB"><span style="mso-tab-count:1"> </span>Freds
writing has become smoother since August, and she organizes her thoughts much
better now than then.<span style="mso-spacerun: yes"> </span>
It looks like a little box in IE, a question mark in a diamond in Firefox. Ironically, it looks perfect in Google Chrome. I don't want to tell all the parents that they need to download Google Chrome in order to make it look good though. There would be angry parents.
Can I add something to the PHP code so that it parses all of the formatting for spaces and apostrophes without the weird characters?