CodeIgniter Forums

Full Version: weird characters for apostrophes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Im pulling stuff out of my db to display. Some of my entries have apostrophes, but when i pull them out and display them they are changed to this ’57 . How do i change this back to apostrophes??


class Mains extends Controller {

    function Mains()

    function index()
        $data['title'] = "Home";
        $data['heading'] = "All Events";
        $data['query'] = $this->db->get('test');
        $this->load->view('main_view', $data);


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
&lt;html &gt;
&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
<h1>&lt;?php echo $heading; ?&gt;</h1>
&lt;?php if($query->num_rows() > 0): ?&gt;

&lt;?php foreach($query->result() as $row): ?&gt;

    <h3>&lt;?php echo $row->title; ?&gt;</h3>
    <p>&lt;?php echo stripslashes($row->description); ?&gt;</p>

    &lt;?php endforeach; ?&gt;
&lt;?php endif; ?&gt;

El Forum

I'm thinking the apostrophes in your database may not be apostrophes but "slanted apostrophes", like MS Word and some other text editers convert them to. Go through your database and make sure that they are in fact real apostrophes.

El Forum

good thought but im sure they are apostrophes

El Forum

[eluser]Greg Aker[/eluser]
Try setting your charset to utf-8:

&lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;