PHP problems with apostrophes and Quotation marks


akhilkumar332Staff12h Helped me with this topic late in August 2017

My website is

The specific subpage is

I started with an htlm/css website that I wrote, and got tired of of re-writing the NAVBAR on each page, so I made a php page to contain the NAVBAR. I call the NAVBAR with the command

<?php include('navbar.php');?>

Works Beautifly, except that apostrophes and quotation marks
get written to the screen as question marks

On akhilkumar’s advice I added this to .htaccess
AddDefaultCharset Off

AND I put this (started line with <)
meta charset=“utf-8” >
into the head of:

Note: 1st character in each line below is <
Preview won’t reproduce line if I start it with <

!DOCTYPE html>
title>GM Volt Writer
meta charset=“utf-8” >
meta name=“description” content=“GM Volt” />
link href=“stylesheet.css” rel=“stylesheet” type=“text/css” />

I also tried
meta charset=“utf-8” />
because of some suggestions I found online

I also tried some other charsets besides utf-8

Can someone tell me where I’m in error?


Try this

<!DOCTYPE html>
<title>GM Volt Writer</title>
<meta charset=“utf-8” >
<meta name=“description” content=“GM Volt” />
<link href=“stylesheet.css” rel=“stylesheet” type=“text/css” />


Hi ckhawand,

As I type stuff in this window, I notice that some html statements just do not show up in the preview window. In my last note, I was trying to get around that problem, without success.

If you could go to

you’ll see the problem, and if you hit Ctrl+U, you’ll see I already have exactly as you suggest.

Good! At least I’m on the right track, but can you see what I’m doing wrong?


Do you mean those �?


Yes, that’s it exactly!


Add this to your php script
header(“Content-type: text/ html; charset=utf-8”);


where, in

do I put it?
in the header? Before the header? after it?

I really don’t know anything about php, except that one command

<?php include('navbar.php');?>


Put it after the include line


I tried it, but no luck, it didn’t work


Do you load HTML content from your database?

Put this inside <head> tag.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


Hi Supon,

I put it in
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

It didn’t help

Actually, ckhawand suggested something similar earlier
<meta charset=“utf-8” >

It didn’t work, either


What is the text editor you use?


I used Microsoft’s Text editor. The files it creates, the files that I upload to the server are ascii


This is a weird problem. Can you try using Sublime text and try again.


Hi Supon,

What is Sublime text? Won’t it just produce ascii? Isn’t ascii just ascii, no matter where it comes from?


Can you type those ASCII characters on the forum?


Hi Supon - I don’t understand - what would you like me to do?


Actually, i can’t tell you an exact answer. I guess it might be a problem with your text editors encoding. I asked you to try using Sublime Text. Download it and open your file with it. Then save it in encoding utf-8 and upload.


Later tonight, I’ll see IF I can get either of my Ubuntu computers to work. If I can I’ll download Sublime Text – Thanks Again!


Hi Supon,

It LOOKS like I solved the problem. I downloaded Sublime text from

I opened the old ascii file
and saved it as utf-8

I also opened another file I had the same problem with:
and saved it as utf-8

They both seem OK

After I finish updating the whole website, I would be glad to write this up as some sort of application note, if you think it will be helpful. Please don’t close this yet, because I want to first see if any similar problems pop up.

Again - Thanks

  • Gary