PHP form - Russian characters

Hi, ive no idea what im dong wrong…the rest of the site is fine, however form the db is doing my head in. Text entered as ‘шынчебюз’ is entered into the db as ‘шынче’

Prior to submitting the form i use:

$name = mysqli_real_escape_string($dbc, trim($_POST["name"]));

The database connection has:

DEFINE(‘DATABASE_USER’, ‘');
DEFINE(‘DATABASE_PASSWORD’, '
’);
DEFINE(‘DATABASE_HOST’, ‘');
DEFINE(‘DATABASE_NAME’, '
’);
mysql_set_charset(‘utf8’);

$dbc = @mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD,
DATABASE_NAME);

The database is set to ‘utf8_unicode_ci’ and the parent html file (which the php form is loaded into) has:

meta http-equiv=“content-type” content=“text/html; charset=UTF-8”

any thoughts?..thanks in advance

1 Like
mysqli_connect
mysql_set_charset

Do you find these calls consistent?

1 Like

ahhhhhhhhhh…what a c@ck!.. after the connection ive now put

$dbc->set_charset(‘utf8’);

…and it works fine :slight_smile:

Thanks alot!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.