Re: [PHP] trouble sending japanese to mysql database!

2009-03-05 Thread James
Ah, no I hadn't (*red face*), thanks very much, works beautifully now!

James


"Eric Butera"  wrote in message 
news:6a8639eb0903051302s3b398a00m2287b15a33d3b...@mail.gmail.com...
> On Thu, Mar 5, 2009 at 2:06 PM, James  
> wrote:
>> Right, I'm having some rather strange issues between mysql and php when 
>> it
>> comes to inserting Japanese text. I have the table and fields set to
>> utf8_unicode_ci, if I use phpmyAdmin to insert japanese text through the
>> interface it works just fine. If I use phpmyadmin but type in the mysql
>> insert command in the interface it works just fine. If I use php to 
>> connect
>> to the database and insert the text recieved from a html form I get what
>> looks like the ascii codes in the record rather than the text, however if 
>> I
>> print that text to the browser window at the same time, the browser still
>> renders it as normal japanese characters.
>>
>> So:
>> ??
>>
>> Is converted to :
>> インジェクターが点火順序で個別に開く|&#
>> The php I'm using is:
>>
>> $link = mysql_connect($DBhost,$DBuser,$DBpass);
>> mysql_set_charset('utf8',$link);
>> $db_selected = mysql_select_db($DBName, $link);
>> if (!$db_selected) { die ('Database access error : ' . mysql_error());}
>>
>> $query = "INSERT INTO `QuestionsJA` (ID, QuestionText, AnswerText, 
>> Correct,
>> Type, QGroup, Active) VALUES ('$QID','$QText', '$Ans', '$Cor', '$Type',
>> '$QGroup', '$Active')";
>>
>> mysql_query($query) or die('Error, Feedback insert into database failed')
>>
>> I can output the variables containing the text into the browser and it
>> displays as it should, just seems to be the communication between php and
>> mysql.
>>
>> Please help, this is driving me nuts.
>>
>> I've also tried adding:
>>
>> mysql_query ('SET NAMES utf8');
>> mysql_query ('SET character_set_client = utf8');
>> mysql_query ('SET character_set_results = utf8');
>> mysql_query ('SET character_set_connection = utf8');
>>
>> to the script but still no difference.
>>
>> Thanks
>> James
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Do you have a meta tag and http header stating your content is utf8?
>
> 
>
> header('Content-Type: text/html; charset=utf-8');
>
> -- 
> http://www.voom.me | EFnet: #voom 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] trouble sending japanese to mysql database!

2009-03-05 Thread Eric Butera
On Thu, Mar 5, 2009 at 2:06 PM, James  wrote:
> Right, I'm having some rather strange issues between mysql and php when it
> comes to inserting Japanese text. I have the table and fields set to
> utf8_unicode_ci, if I use phpmyAdmin to insert japanese text through the
> interface it works just fine. If I use phpmyadmin but type in the mysql
> insert command in the interface it works just fine. If I use php to connect
> to the database and insert the text recieved from a html form I get what
> looks like the ascii codes in the record rather than the text, however if I
> print that text to the browser window at the same time, the browser still
> renders it as normal japanese characters.
>
> So:
> ??
>
> Is converted to :
> インジェクターが点火順序で個別に開く|&#
> The php I'm using is:
>
> $link = mysql_connect($DBhost,$DBuser,$DBpass);
> mysql_set_charset('utf8',$link);
> $db_selected = mysql_select_db($DBName, $link);
> if (!$db_selected) { die ('Database access error : ' . mysql_error());}
>
> $query = "INSERT INTO `QuestionsJA` (ID, QuestionText, AnswerText, Correct,
> Type, QGroup, Active) VALUES ('$QID','$QText', '$Ans', '$Cor', '$Type',
> '$QGroup', '$Active')";
>
> mysql_query($query) or die('Error, Feedback insert into database failed')
>
> I can output the variables containing the text into the browser and it
> displays as it should, just seems to be the communication between php and
> mysql.
>
> Please help, this is driving me nuts.
>
> I've also tried adding:
>
> mysql_query ('SET NAMES utf8');
> mysql_query ('SET character_set_client = utf8');
> mysql_query ('SET character_set_results = utf8');
> mysql_query ('SET character_set_connection = utf8');
>
> to the script but still no difference.
>
> Thanks
> James
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Do you have a meta tag and http header stating your content is utf8?



header('Content-Type: text/html; charset=utf-8');

-- 
http://www.voom.me | EFnet: #voom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] trouble sending japanese to mysql database!

2009-03-05 Thread James
Right, I'm having some rather strange issues between mysql and php when it 
comes to inserting Japanese text. I have the table and fields set to 
utf8_unicode_ci, if I use phpmyAdmin to insert japanese text through the 
interface it works just fine. If I use phpmyadmin but type in the mysql 
insert command in the interface it works just fine. If I use php to connect 
to the database and insert the text recieved from a html form I get what 
looks like the ascii codes in the record rather than the text, however if I 
print that text to the browser window at the same time, the browser still 
renders it as normal japanese characters.

So:
??

Is converted to :
インジェクターが点火順序で個別に開く|&#
The php I'm using is:

$link = mysql_connect($DBhost,$DBuser,$DBpass);
mysql_set_charset('utf8',$link);
$db_selected = mysql_select_db($DBName, $link);
if (!$db_selected) { die ('Database access error : ' . mysql_error());}

$query = "INSERT INTO `QuestionsJA` (ID, QuestionText, AnswerText, Correct, 
Type, QGroup, Active) VALUES ('$QID','$QText', '$Ans', '$Cor', '$Type', 
'$QGroup', '$Active')";

mysql_query($query) or die('Error, Feedback insert into database failed')

I can output the variables containing the text into the browser and it 
displays as it should, just seems to be the communication between php and 
mysql.

Please help, this is driving me nuts.

I've also tried adding:

mysql_query ('SET NAMES utf8');
mysql_query ('SET character_set_client = utf8');
mysql_query ('SET character_set_results = utf8');
mysql_query ('SET character_set_connection = utf8');

to the script but still no difference.

Thanks
James 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php