user1250526
user1250526

Reputation: 309

special characters turn into question marks php html

I read all the topics found on stackoverflow and other forums, it's hosted on hostgator and I've never had problems with their servers before although quotes for example are transformed into question marks, normal ones not with black diamonds or anything. Here is what I've tried:

 header('Content-Type: text/html; charset=utf-8');

and

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

This is what I use for doctype if that matters:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I use Unitron for osx to write my code and I've checked that the files should include utf-8.

And the text that I am trying to display is just html, within a php page.

Anyone have any clue on how to help me?

Upvotes: 3

Views: 9629

Answers (3)

adrien
adrien

Reputation: 4439

Check that your file is encoded in UTF8, for instance with Notepad++ go to "Encoding" > "Convert in UTF8" and save the file.

Upvotes: 3

sidon
sidon

Reputation: 1482

Just a guess: Check that quotation marks you have in you html are really quotation marks. They can be some other characters that just looks the same but aren't. This can happen when copy-pasting from some other source.

Try rewriting part of code that is causing the problem by hand.

If that's not the case, try using one or both of these php functions:
mb_internal_encoding
mb_http_output

Also your HTML is not valid: HTML validator

Upvotes: 0

bigblind
bigblind

Reputation: 12867

You should use htmlentities to convert any entities in your text to html entities; for example, the copyright sign will become © &copy;

Upvotes: 2

Related Questions