jquery - Php page display some strange symbols instead of BULLETED LISTS from CSV file?
I am retrieving some data from mysql everything is fine data fetched from database and display on page. but, their is some issue I want to display data line by line as a BULLETED LISTS as I insert data in mysql table's column features. But it is not shown same on page why ? or how can I retrieve bulleted list type data to php page ? I searching too much but not find any specific answer.
My Php Code :
<div >
<p >Features :</p>
<pre >'.$userfeatures.'</pre>
</div>
Output on php page :
Answer
Solution:
This is because different text-encoding (character set) is being used in your database and the text document displaying the bulleted list.
You should set you database and documents to use the same character set, usually UTF8.
For the database, you can do it in PHPMyAdmin, or if you are using PHP mysqli you can use the following PHP code:
In your documents, save with encoding UTF-8.
However, as pointed out in the comments, you should also separate out your data and presentation. The database should only hold data, your application decides how it should be displayed. Consider a situation where your app might need to display the data somewhere else, maybe with a different bullet?
As Saurabh says, save your data without bullets on separate lines. Then display them using:
Also, it would be a good idea to put your styling into a separate CSS file.
Answer
Solution:
This means, there are different encodings.
In HTML you have to put
at the beginning,in PHP you have to add
and at your database you have to set your charset also as utf-8-general.
Then it should work :)