troubleshooting Question

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

Avatar of Tim Brocklehurst
Tim BrocklehurstFlag for United Kingdom of Great Britain and Northern Ireland asked on
Visual Basic.NETMySQL Server.NET App Servers.NET ProgrammingASP.NET
9 Comments1 Solution505 ViewsLast Modified:
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
           
            '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

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
Tim
ASKER CERTIFIED SOLUTION
Tim Brocklehurst
Head of Digital

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros