Jump to content

Apostrophes, Speech Marks pulling through strangely


stublackett

Recommended Posts

Hi,

 

Just working on a Football Clubs' website and I have a match report pulling through, But when its pulling through apostrophes and speech marks. The characters are coming out as squares in IE and small diamond shaped question marks in FireFox.

 

How do I tell PHP just to output the character as an apostrophe? An example of what I mean is at : http://www.berwickrangers.net/test/report.php?reportID=1

 

As you can see from this exert :

Berwick Rangers turned in one of their best 45 minute spells of the last five years to blow title hopefuls East Stirling off the park in a superb match at Ochilview on Saturday. Darren Gribben grabbed the headlines with a slickly-taken hat-trick, but it was Rangers�

 

It should say Rangers' at the end not a �

I've tried stripslashes but no joy.

 

Any help appreciated :)

Link to comment
Share on other sites

or change your encoding in your headers.  If it's set to UTF-8 now try iso-8859-1  or vice versa

And the meta tag, for IE.

 

How do I achieve that Axeia?

 

I've tried setting it as htmlspecialchars

<?php echo htmlspecialchars ($report); ?>

 

But its coming out like this :

 

erwick Rangers turned in one of their best 45 minute spells of the last five years to blow title hopefuls East Stirling off the park in a superb match at Ochilview on Saturday. Darren Gribben grabbed the headlines with a slickly-taken hat-trick, but it was Rangers� teamwork which destroyed one of the best Shire sides in recent memory. Shire had come into the match as the Third Division�s form outfit, with six wins from their previous seven matches. The margin of Rangers� victory looked an unlikely prospect at half time after Shire had embarked on a mini-blitzkrieg following Gribben�s opener, but such was the extent of the Gers� domination after the break that they could have won by seven or eight clear goals.<br /> <br />

 

and those damn Diamond things are still there ???

Link to comment
Share on other sites

I'm getting

Fatal error: Call to undefined function mb_convert_encoding()

 

The code is in an include file titled "match-report.php"

<?php
include ("dbconnect.php");
# Connect to PHPMyAdmin DB
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($dbname,$db);
error_reporting(E_ALL);

$result = mysql_query("SELECT *, DATE_FORMAT( date, '%W %D %M %Y' )AS uk_date FROM $db_table4 WHERE reportID='$_GET[reportID]'");
while($myrow = mysql_fetch_assoc($result))
        {//begin of loop	
		$reportID = $myrow['reportID'];
		$headline = $myrow['headline'];	
		$reportdate = $myrow['uk_date'];
		$location = $myrow['location'];
		$attendance = $myrow['attendance'];
		$lineup = $myrow['lineup'];
		$lineup = nl2br($lineup);
		$scorers = $myrow['scorers'];
		$bookings = $myrow['bookings'];
		$report = $myrow['report'];
		$report = nl2br($report);
		$image1 = $myrow['image1'];
		$image2 = $myrow['image2'];
		$image3 = $myrow['image3'];
		$image4 = $myrow['image4'];

	}//End While loop     						
?>

 

Then I'm just echoing $description in the report.php page.

As so :

    <?php
    $report = mb_convert_encoding($report, "ISO-8859-1", "auto");
echo $report;
?>

Link to comment
Share on other sites

Its hosted by Fasthosts and the server is a shared Windows Server.

 

Oh well, never mind. What that function will do is detect the encoding of the string and convert it to ISO-8859-1. Probably would of worked. If you can add extensions to php through your webhost's control panel then I would try. Its the mbstring extension that you need: http://uk3.php.net/manual/en/book.mbstring.php

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.