Pregunta

I have the following value from a field in a database that I would like to output exactly like this...

Use the term “fully accredited”-there is no such thing as a partial accreditation.

I need to include the quotes around the term "fully accredited".

Here's my output in PHP...

echo "<p><strong>Never:</strong>&nbsp;<span id=\"nevermsg\">".$results['never1']."</span></p>";

But, when I render the data on the page, it's showing these little diamond shapes with question marks inside them.

*(The 'span id' is there for styling and isn't relevant)

I don't think escaping would work here because quotes are not used in all the data values.

Not sure what to do...

¿Fue útil?

Solución

The quotes in your string are extended characters.

You could fix this problem pretty quickly by simply replacing them with standard " quote characters rather than the curly quotes “ ” you've got now.

However, in the long term, you probably need to be able to handle extended characters, as it includes all kinds of things you're likely to need in your text, not just curly quote marks.

To fix this problem properly, you need to ensure that your system uses UTF-8 encoding at all levels. This includes within the database, your PHP code files, and the data that is sent to the browser.

I suggest reading up further on this here: UTF-8 all the way through

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top