UTF-8 encoding problem
I am using notepad ++ for php encoding.
I have no problem setting the format using Encode in ANSI.
However, when I use Encode in UTF-8, I have a strange character at the top or showing nothing.
Q1. Should I use ANSI? Q2. Why can't I display anything when I am using UTF-8
The following is my header code for the header.
<html>
<head>
<title>Hello, PHPlot!</title>
</head>
Is it because I am not using UTF-8 in the header?
source to share
This is probably the Order Mark Byte . You can use the Encode to UTF-8 No BOM mode in notepad ++.
This question has some useful information about using UTF-8 with PHP. You also (as you said) have to set the content-type in the header or meta tag for the browser to interpret it correctly.
source to share
It looks like you are using UTF-8 with BOM ( issues ) and your server cannot specify the encoding correctly .
IIRC, spec is inevitable in Notepad, so I would suggest using a better editor. I love Komodo Edit myself.
(Also note that Doctype is required in HTML documents )
source to share
As Tom Haig says, this is probably a specification. These are not necessary for UTF-8 encoding, so you can safely leave them.
However, I must point out that PHP has very poor UTF-8 support - be prepared for a bumpy ride. Check out this page for details on the issues you may encounter.
source to share