We help IT Professionals succeed at work.
Get Started

Greek Characters convert to '?' s on export from SQL using VB.net

Last Modified: 2016-09-04
We have developed a web app hosted on Azure, which copies the records in a SQL View to a MySQL Db for a Wordpress Website.
All is working fine, but it is a scientific website and some of the records contain greek letters. These characters are not being carried over correctly, and display as question marks on the website.

On investigation, I have read that others had success with a similar issue by forcing conversion of the field containing the greek characters to UTF-8 with a SQL command on the My SQL destination Db, others found converting it to Latin1 resolved their issue. However, I had success with neither of these.  I also discovered that the greek characters appear to be converted to question marks before being sent to the MYSQL: When outputting the field values with console.writeline() in the vb code, the values expressed display '?'s instead of greek characters before they are exported to the MySQL Db.

So I'm wondering if there is any known process which I can put those fields through to ensure the greek characters are kept and remain untranslated to '?'s in the export functionality.

Incase it helps, following is a sample of the code used to write the values from the SQL view to the MySQL table:

        Dim DBAAW As New MasterDBEntities '(this is the SQL Db)
        'first find the Antibody Record by its HCConstructNumber
        Dim WARecord = (From wq In DBAAW.WP_Whole_Antibodies_on_Sale
                        Where wq.HCConstructNumber = HCC
                        Select wq).FirstOrDefault()
        If (WARecord IsNot Nothing) Then
            With WARecord
			SyncHelp.AddNewMeta(postID, "wpcf-specificitystatement", .SpecificityStatement)
                        Console.WriteLine("Synonyms: " & .Synonyms)
                        SyncHelp.AddNewMeta(postID, "wpcf-synonyms", .Synonyms)
	     End With
	End If

Open in new window

            'And this is what SyncHelp.AddNewMeta does to update the post's record in MySQL:
Public Shared Sub AddNewMeta(p1d As Long, metakey As String, metaval As String)
        Dim PMMta As New absolute_fix1Entities '(the MySQL Db)
        Dim xdel As Integer
        Dim meta = (From s In PMMta.antibody_postmeta
                              Where s.post_id = p1d And s.meta_key = metakey
                              Select s).FirstOrDefault()
        If meta IsNot Nothing Then
		            meta.meta_value = Mval
        End If
End Sub

Open in new window

So you see I am simply writing the value stored in the SQL View's [SpecificityStatement] and [Synonym] field, to the corresponding [meta_value] field in the MySQL's post_meta table for Wordpress.

This works fine for all string data types, but not for the greek characters in them.

Is there something else I should  be doing here to keep Greek characters as they are (and not change them to '?'s)  ?

Thank you
Watch Question
Head of Digital
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE