Jump to content

[SOLVED] empty square instead of an apostrophe


exhaler

Recommended Posts

hi,

when reading names from mysql i have some names with an apostrophe sush as

Aysh A’ssaraya

here's my code to insert the names

$name = mysql_prep(trim($_POST['name']));
function mysql_prep( $value ) {
	$magic_quotes_active = get_magic_quotes_gpc();
	// i.e. PHP >= v4.3.0
	$new_enough_php = function_exists( "mysql_real_escape_string" ); 
	if( $new_enough_php ) { // PHP v4.3.0 or higher
		// undo any magic quote effects so mysql_real_escape_string can do the work
		if( $magic_quotes_active ) { $value = stripslashes( $value ); }
		$value = mysql_real_escape_string( $value );
	} else { // before PHP v4.3.0
		// if magic quotes aren't already on then add slashes manually
		if( !$magic_quotes_active ) { $value = addslashes( $value ); }
		// if magic quotes are active, then the slashes already exist
	}
	return $value;
}

but when i'm displaying them i get an empty square in place of the apostrophe depeding on the browser, (i get a question mark in opera and firefox.)

i.e: Aysh A�ssaraya

 

my display code

$name =  stripslashes($row['name']);
echo $name;

 

i tried using htmlentities() but its not working

any ideas

thanks

 

thx, turns out that i had this in my header.php

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

which caused the problem

i replaced it with this

<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />

and now its fixed

should i use another type??

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.