• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 472
  • Last Modified:

encoding in mysql

hi,
 i have a problem in mysql database.my problem is the Arabic characters are stored and displayed in phpmyadmin and even in asp.net application as numbers format like ᷧ
how to solve this problem and display it correctly.

please take a look on the attached image.

thanks.
Untitled.jpg
0
Balshe
Asked:
Balshe
  • 4
  • 4
  • 2
  • +2
3 Solutions
 
Om PrakashCommented:
please check the following thread, it has one working example as well
http://www.webdeveloper.com/forum/showthread.php?t=100099
0
 
BalsheAuthor Commented:
dear,
i had read this thread before,but this case is different from mine cause the text in this thread is displayed as ????? but not like ᕛ
so this thread is not help me.
0
 
Loganathan NatarajanLAMP DeveloperCommented:
Just select UTF-8 on your browser to view the corrected Arabic texts.
0
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
rubeneCommented:
Hi,

It looks like your arabic characters got converted to html entities. You'll be able to view those in an html viewer (such as a webbrowser). But if that's not what you want you should check to see where the conversion into html entities takes place.
0
 
BalsheAuthor Commented:
Hi,
I want to display the data correctly in the phpmyadmin in order to move it to sql server or oracle.
thank you.
0
 
Loganathan NatarajanLAMP DeveloperCommented:
Hi,

Did you try to adjusted the browser on encoding UTF-8 ? see the attachment please utf8
0
 
rubeneCommented:
Hi Balshe,

PhpMyAdmin will just literary show what's in the database. In this case it's html entities. If you want to convert those back to utf-8 then you should write a script for it that does that job.

In PHP you could use the html_entity_decode function. So if you were to write a script to do this you'd just retrieve every row and replace the contents with utf-8.

// ... foreach row...
$newData = html_entity_decode($oldData,ENT_QUOTES, "utf-8");
// ...update row...
0
 
BalsheAuthor Commented:
dear expert,
honestly i am not php developer and i have no knowledge in it, i am asp.net one, and of course  i tried to change the encoding of the browser but it was useless. so, would help me in finding way even it is in asp.net to display this data,i mean is there an equivalent vb.net or c#.net code to the above php function .
moreover i tried to put

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" /> or
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
in the aspx page but the problem still exists.

thanks dear.
0
 
rubeneCommented:
Hi Balshe,

Changing the encoding of the browser won't work with phpmyadmin, because as I said phpmyadmin just shows the data as is from the database without actually rendering the html entities.

If you're not familiar with php you could do the same thing with c# or vb. There's the HttpUtility class in System.Web with a static method HtmlDecode, see: http://msdn.microsoft.com/en-us/library/system.web.httputility.htmldecode.aspx
0
 
BalsheAuthor Commented:
dear ,
thank you for sending the above link because it help me in developing solution for my problem,and the solution is:

      Dim drcon As New SqlConnection(ConfigurationManager.ConnectionStrings("SalesConnectionString2").ConnectionString)
        drcon.Open()
        Dim drug_insert As SqlCommand = New SqlCommand("InsertIntoTable", drcon)
        drug_insert.CommandType = CommandType.StoredProcedure
        Dim str1 As String
        Dim str2 As String
        Dim sb1 As StringBuilder
        Dim sb2 As StringBuilder
        HttpUtility.HtmlDecode(row.Cells(1).Text)
        HttpUtility.HtmlDecode(row.Cells(2).Text).ToString
        drug_insert.Parameters.Add("@sell_location", SqlDbType.NVarChar)
        drug_insert.Parameters.Add("@c_name", SqlDbType.NVarChar)


        For Each row As GridViewRow In GridView1.Rows
            str1 = HttpUtility.HtmlDecode(row.Cells(1).Text)
            str2 = HttpUtility.HtmlDecode(row.Cells(2).Text)
            ' Encode the string input
            sb1 = New StringBuilder(HttpUtility.HtmlDecode(str1))
            sb2 = New StringBuilder(HttpUtility.HtmlDecode(str2))

            drug_insert.Parameters(0).Value = sb1.ToString()
            drug_insert.Parameters(1).Value = sb2.ToString()
            drug_insert.ExecuteNonQuery()

            drug_insert.ExecuteNonQuery()
            sb1 = Nothing
            sb2 = Nothing
            str1 = Nothing
            str2 = Nothing
        Next
        drcon.Close()
        drcon.Dispose()
        drug_insert.Dispose()

        SqlDataSource2.DataBind()
        GridView2.DataBind()
0
 
rubeneCommented:
My answers were code snippets of course leaving out all the unrelated details, such as connecting to the database and iterating through the result rows. In my humble opinion this platform isn't meant for writing full-working programs in the comments, it's about solving a specific problem, which I think I did here.
If the author still doesn't feel like rewarding the points to me that's okay, but I still feel like I deserve them for my solution.
0
 
modus_operandiCommented:
Restarting auto-close process on Balshe's behalf.
 
modus_operandi
EE Admin
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now