I have a long description field in a products table with a data type: text. The collation is latin1_swedish_ci for reference.
For products in my database I need a superscript 2, bullet points for a list and line breaks. For example when the bullet points output on the page they output as:
•
Is there any way round this so i can display my long description correctly with line breaks too?
$product = $this->MProducts->getProduct($id);
$data['product'] = $product;
<?php echo "<p style='clear:both; padding-top:10px;'>".$product['longdesc']."</p>";?>
Regards,
You have to ensure that you’re retrieving the right character set from MySQL.
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
And you have to ensure that the string is unicode after you receive it.
http://php.net/manual/en/function.utf8-encode.php
And you have to encode html entities if you’re outputting to a browser. Specifying a charset here is important too.
http://php.net/manual/en/function.htmlentities.php
Hope that helps…