Colin
Colin

Reputation: 43

Characters not displaying correctly in different browsers

I used certain characters in website such as • — “ ” ‘ ’ º ©. I found that when testing to see what my website looked like under different browsers (BrowserLab) the afore-mentioned characters are replaced with �.

I then changed the charset in the webpage header from:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

to

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Suddenly all the pages have the above mentioned characters replaced with a ?.

Even more puzzling is this is not always consistent across and even within the same page, as some sections display the character and © correctly.

In particular, I need to replace the character with one that will display across browsers, can anyone help me with the answer? Thanks.

Upvotes: 4

Views: 5514

Answers (5)

Hemanth Gatadi
Hemanth Gatadi

Reputation: 1

If you're using Notepad++, I suggest You to use Edit Plus editor to copy the text (which has the special characters) and paste it in your file. This should work.

Upvotes: 0

deceze
deceze

Reputation: 522024

The source code needs to be saved in the same encoding as you're instructing the browser to parse it in. If you're saving your files in UTF-8, instruct the browser to parse it as UTF-8 by setting an appropriate HTTP header or HTML meta tag (headers preferable, your web server may be setting one without you knowing). Use a decent editor that clearly tells you what encoding you're saving the file as. If it doesn't display correctly, there's a discrepancy between what you're telling your browser the file is encoded in and what it's really encoded in.

Upvotes: 1

Jack U
Jack U

Reputation: 1

Yes I had this problem too in notepad++ copy and pasting wasn't working with some symbols

I think SLaks is right

HTML entities for copyright symbol &#169

Upvotes: -2

Jared Kipe
Jared Kipe

Reputation: 1187

Check to see if Apache is setup to send the charset. Look for the directive "AddDefaultCharset" and set it to Off in .htaccess or your config file.

Most/all browsers will take what is sent in the HTTP headers over what is in the document.

Upvotes: 0

SLaks
SLaks

Reputation: 887355

You should save your HTML source as UTF8.

Alternatively, you can use HTML entities instead.

Upvotes: 2

Related Questions