0

This SQL has failed.

SQL is

INSERT INTO
    `migration_loose_terms`
    (`source`,`field`,`term`,`lastaccess`)
VALUES
    ('services.media','keywords','spermatozoïde','2012-04-25 12:00:00')

Because it contains a weird (ï) character.

What function do you use in php/mysql to weed out the nonascii characters to be stripped or to make that word somehow into mysql?

Hammerite
  • 21,755
  • 6
  • 70
  • 91
Average Joe
  • 4,521
  • 9
  • 53
  • 81

1 Answers1

2

If you want to strip the non ASCII characters you can use the following code :

<?php
$input = "Clean the non ASCII äócharacters.";
$output = preg_replace('/[^(\x20-\x7F)]*/','', $input);
echo $output;
?>

otherwise, have you tried to wrap the word in question with mysql_real_escape_string ?

Jérémie Parker
  • 3,184
  • 2
  • 20
  • 33