Welcome Guest, Not a member yet? Register   Sign In
Text input not being processed properly!
#11

[eluser]Tominator[/eluser]
1. in HTML:
Code:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
2. save your files in UTF-8 encoding
3. set your DB/table/fields to UTF-8
4. doesn't work? try:
Code:
mysql_query("SET CHARACTER SET utf8");
#12

[eluser]TheFuteballer[/eluser]
[quote author="Tominator" date="1272724946"]1. in HTML:
Code:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
2. save your files in UTF-8 encoding
3. set your DB/table/fields to UTF-8
4. doesn't work? try:
Code:
mysql_query("SET CHARACTER SET utf8");
[/quote]

Thanks Tominator, a combination of all of these as well as other methods eventually fixed my issue. Just for anyones future reference, I set my DB to UTF8 charset and used the following script to convert all the tables and fields to UTF8, used step 4 above and then wrapped everythign in htmlentities function.

Code:
<?php
// Script written by Vladislav "FractalizeR" Rastrusny
// http://www.fractalizer.ru

//MySQL connection settings
$db_server = '...';
$db_user="...";
$db_password="...";

mysql_connect($db_server, $db_user, $db_password) or die(mysql_error());

//Put here a list of databases you need to change charset at or leave array empty to change all existing
$dblist=array();

//If changing at all databases, which databases to skip? information_schema is mysql system databse and no need to change charset on it.
$skip_db_list = array('information_schema', 'mysql');

//Which charset to convert to?
$charset="utf8";

//Which collation to convert to?
$collation="utf8_unicode_ci";

//Only print queries without execution?
$printonly=false;

//Getting database names if they are not specified
$skip_db_text = '"'.implode('", "', $skip_db_list).'"';
if(count($dblist)<1) {
    $sql="SELECT GROUP_CONCAT(`SCHEMA_NAME` SEPARATOR ',') AS FRST FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME` NOT IN ($skip_db_text)";
    $result = mysql_query($sql) or die(mysql_error());
    $data = mysql_fetch_assoc ($result);
    $dblist=explode(",", $data["FRST"]);
}

//Iterating databases
foreach ($dblist as $dbname) {
    $sql="SELECT CONCAT('ALTER TABLE `', t.`TABLE_SCHEMA`, '`.`', t.`TABLE_NAME`, '` CONVERT TO CHARACTER SET $charset COLLATE $collation;') as FRST FROM `information_schema`.`TABLES` t WHERE t.`TABLE_SCHEMA` = '$dbname' ORDER BY 1";

    $result = mysql_query($sql) or die(mysql_error());
    while ($row = mysql_fetch_assoc($result)) {
        echo $row["FRST"]."
\r\n";
        if(!$printonly) {
            mysql_query($row["FRST"]) or die(mysql_error());
        }
    }
}
?&gt;

Code:
mysql_query("SET NAMES 'UTF8'");

Code:
htmlentities($input, ENT_QUOTES, "UTF-8", FALSE),




Theme © iAndrew 2016 - Forum software by © MyBB