Shamrockonov
Shamrockonov

Reputation: 489

Encoding error causes MS SpecialChars to be shown as question marks

So when I retrieve a column from my database and echo the string in php it displays microsoft special chars as this �.

However if I copy the string from the cell, paste it into my script and echo it directly, I get the correct content.

At what stage between retrieving the data and displaying it is this going wrong?

It is an MS SQL database. If any more information on current set up will help, let me know and I will supply it, it's just at this point I'm not sure what will be usefull and what wont.

Upvotes: 0

Views: 25

Answers (1)

Geoff Atkins
Geoff Atkins

Reputation: 1703

It's down to encoding.

Is your database table encoded in the same character set as the PHP document, e.g. UTF=8?

If you can, either change the database table's collation or the PHP document's encoding, either with

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

or

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

with the correct character set.

Upvotes: 2

Related Questions