Need help apostroph doesn't show up in the output.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iosephos
Forum Newbie
Posts: 4
Joined: Wed Mar 11, 2009 3:47 pm

Need help apostroph doesn't show up in the output.

Post by iosephos »

hello i am using fckeditor in the website and i have the apostroph error it doesn't show up in the out i am using this code for it :

<? $allquery = "SELECT * FROM txtfixe WHERE id_txtfixe = 1 limit 1";
$allresult = mysql_query($allquery) or die("Error: " . mysql_error());
$num = mysql_num_rows( $allresult);
while ($author = mysql_fetch_array($allresult))

{
$txtfixe = htmlentities($author ["txtfixe"]);} ?>


the out put is :

<?=$txtfixe?>

can anyone help please ? most of the text in the web is in french lang and the apostroph doesnt show up , ex : l'école in the output its like this l'école .

any help please.
Dummy 2
Forum Newbie
Posts: 5
Joined: Wed Mar 11, 2009 7:33 am

Re: Need help apostroph doesn't show up in the output.

Post by Dummy 2 »

just add the \ (backslash) in front of the apostrophe
example
<?php
echo 'l\' apostrophe again\' somesthing ';
?>

However, If u are retreiving from database, It can be problem with ur database. May be u need unicode coding!
iosephos
Forum Newbie
Posts: 4
Joined: Wed Mar 11, 2009 3:47 pm

Re: Need help apostroph doesn't show up in the output.

Post by iosephos »

its didnt work my friend i did put this

$txtfixe = html_entity_decode($author ["txtfixe"]);

it shows me all the quote but not all the htmlentities...
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Need help apostroph doesn't show up in the output.

Post by requinix »

Somehow ENT_QUOTES was passed to an earlier call of htmlspecialchars or htmlentities.
Once you get the apostrophe back, call htmlentities. Yeah, it's weird, but it should work.

Or you could do a simple search-and-replace on the original version, searching for "'" and replacing it with a '.
iosephos
Forum Newbie
Posts: 4
Joined: Wed Mar 11, 2009 3:47 pm

Re: Need help apostroph doesn't show up in the output.

Post by iosephos »

tasairis wrote:Somehow ENT_QUOTES was passed to an earlier call of htmlspecialchars or htmlentities.
Once you get the apostrophe back, call htmlentities. Yeah, it's weird, but it should work.

Or you could do a simple search-and-replace on the original version, searching for "'" and replacing it with a '.

how shoul i call it back in this script :S it's so weird
iosephos
Forum Newbie
Posts: 4
Joined: Wed Mar 11, 2009 3:47 pm

Re: Need help apostroph doesn't show up in the output.

Post by iosephos »

i fixed it

its not the php code

its the Encoding in the html page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


it should be like this :

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Post Reply