Jump to content

Displaying sentence containing a single quote extracted from mysql?


leafer

Recommended Posts

I've tried everything (htmlspecialchars, htmlentities, html_entity_decode with ENT_QUOTES) and nothing seems to work. It keeps displaying a blue boxed question mark in place of the single quote. The portion of the sentence not displaying properly is "john's".

 

I've manually inserted the info using myphpadmin if that makes a difference.

 

Thx

You said you manually inserted the sentence into your database. Does your single-quote happen to be an apostrophe? If it's an actual apostrophe, you might want to try:

<?php
    htmlentities($str, ENT_COMPAT, 'UTF-8');
?>

You said you manually inserted the sentence into your database. Does your single-quote happen to be an apostrophe? If it's an actual apostrophe, you might want to try:

<?php
    htmlentities($str, ENT_COMPAT, 'UTF-8');
?>

 

It's the key to the left of enter not the one with the tilde sign (~).

 

I tried your method above but now the line itself doesn't display.

It is reasonably certain that if the manually entered data was changed in line with my last post, then you would be able to extract it, apply stripslashes() to it, and have it displayed correctly.

 

With an unescaped single quote in the db data, then in theory it ought to be displayable if placed in double quotes, and it would be interesting to hear anyone elses analysis of that situation

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.