Skip navigation links

MySQL Forums :: Full-Text Search :: Arabic text in mysql Varchar row


Advanced Search

Re: Arabic text in mysql Varchar row
Posted by: Mark Webley ()
Date: September 11, 2011 08:03AM

Currupted db...interesting...looks like then do a mysql table delete and create it again?

I will try that but first I am wondering could it be that because
my html page is utf8 and then when it inserts the data in the the
database that is set to utf8...on insert could the db be converting
the data again....?




But in the meantime I did tests:

The $title value comes from a submitted webform, with title set to:
<input type="text" value="<? echo utf8_decode(POST[title]) ?>"

HTML tag is:
html xmlns="http://www.w3.org/1999/xhtml";; lang="ar" xml:lang="ar" >


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


The <form> tag element has no:
accept-charset="UTF-8"

when I php echo result from the db to the page I use:
nl2br(utf8_decode($title))


TESTS:
when I changed mysql query to utf8_encode($title) to utf8_decode($title):
database shows:
??? ?? ??? ?? ??? ??

after db insert, php echo shows:
??? ?? ??? ?? ??? ??


When I remove both utf8_encode and utf8_decode from the mysql insert query:
database shows:
?? ?? ???? ??

After db insert, php echo shows:
?? ?? ???? ??

To test for existence of double encoding I did:
utf8_decode(utf8_decode($title))

db and php echo shows: ???? ?? ???? ??

Changed back to utf8_encode($title):
db shows: فÙ? اÙ?خط فÙ?
php echo shows: ف�? ا�?خط ف�?





NEW TESTS:
I just added: this to the form tag:
<form accept-charset="UTF-8">

and removed utf8_decode from the form input tag, which is now set to:
<input type="text" value="<? echo POST[title]; ?>"


using mysql insert after form submit with no utf8_encode and utf8_decode for title I see $title:
database shows:
?? ?? ???? ??

After db insert, php echo shows:
?? ?? ???? ??

using mysql insert after form submit with utf8_encode($title):
database shows:
فÙ? اÙ? ف

After db insert, php echo shows:
ف�? ا�? ف

FOR PHP ECHO TO THE PAGE I changed:
nl2br(utf8_decode($title))

TO:
$title

did db insert without utf8_encode and decode db shows: ? ?? ?? ??
did db insert with utf8_encode I see: Ù? فÙ? اÙ?خط



AFTER ALL OF THIS I will delete the table and create a new one...?

Options: ReplyQuote


Subject Views Written By Posted
Arabic text in mysql Varchar row 6040 Mark Webley 09/05/2011 04:23PM
Re: Arabic text in mysql Varchar row 1660 Rick James 09/07/2011 08:01PM
Re: Arabic text in mysql Varchar row 2439 Mark Webley 09/08/2011 04:45PM
Re: Arabic text in mysql Varchar row 1531 Rick James 09/09/2011 06:46PM
Re: Arabic text in mysql Varchar row 2353 Mark Webley 09/11/2011 08:03AM
Re: Arabic text in mysql Varchar row 1385 Rick James 09/12/2011 11:30AM
Re: Arabic text in mysql Varchar row 1906 Mark Webley 09/12/2011 06:16PM
Re: Arabic text in mysql Varchar row 1274 Mark Webley 09/12/2011 06:17PM
Re: Arabic text in mysql Varchar row 1277 Rick James 09/13/2011 09:44PM
Re: Arabic text in mysql Varchar row 1648 Mark Webley 09/17/2011 05:53AM
Re: Arabic text in mysql Varchar row 1338 Rick James 09/18/2011 01:45PM
Re: Arabic text in mysql Varchar row 1379 Mark Webley 09/19/2011 04:10PM
Re: Arabic text in mysql Varchar row 1328 Rick James 09/20/2011 08:19PM
Re: Arabic text in mysql Varchar row 1551 Mark Webley 09/25/2011 12:09PM
Re: Arabic text in mysql Varchar row 1369 Rick James 09/28/2011 09:53PM
Re: Arabic text in mysql Varchar row 1319 Mark Webley 09/29/2011 02:44PM
Re: Arabic text in mysql Varchar row 1869 Rick James 09/30/2011 10:14AM
Re: Arabic text in mysql Varchar row 1983 Rick James 09/10/2011 03:07PM
Re: Arabic text in mysql Varchar row 1894 Mark Webley 09/11/2011 08:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.