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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.