Arabic Characters not readable

Discussion in 'ASP.NET / ASP.NET Core' started by dhamenha, Aug 3, 2010.

  1. I have a problem when displaying Arabic data on my website. (ÍÈíÈ Úáí ÍÈíÈ ÇáÖÇãä )

    http://www.arbpost.com/sandooq/display_memname.aspx

    The problem only occurs when the data is retrieved from the database (MS Access 2000 database).

    I have configured the web.config file to use globalization like this:

    HTML:
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    I have also added the meta tag in the master page as follows:

    HTML:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Sample of the function that retrieve and display the data:

    Code:
        Public Sub disp_MemName()
            Dim db As New DhamenDb
            Dim SQL As String = "SELECT CustName FROM Customers WHERE CustNbr = 1"
            Dim _MemName As String = ""
    
            _MemName = db.getSingleValue(SQL)
    
            If Not String.IsNullOrEmpty(_MemName) Then
                lbl_memName.Text = _MemName
            Else
                lbl_memName.Text = "الأسم غير موجود"
            End If
    
        End Sub
    
        Public Function getSingleValue(ByVal SQL As String) As String
            Dim retVal As Object = Nothing
    
            Using conn As New OleDbConnection(getConnectionString())
                Using cmd As New OleDbCommand(SQL, conn)
                    conn.Open()
                    retVal = cmd.ExecuteScalar()
                End Using
            End Using
    
            If retVal Is Nothing Then
                retVal = String.Empty
            End If
    
            Return retVal.ToString()
        End Function
    
    Connection String is:

    HTML:
    Private _XConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|xyz.mdb;"
    I have also spent 2 weeks searching the net to resolve this issue with no luck, I have searched the discountasp.net forum and no luck as well,
    Any help to resolve this problem will be appreciated.
    Dhamenha.
     
  2. Have you tried specifying a locale in the connection string? e.g.
    Private _XConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|xyz.mdb;Locale Identifier=xxx;"

    Apparently MS advise...for information about the values you can use for the Locale Identifier property, see "Locale Identifier Property Settings" in ADOProperties.doc in the ODETools\V9\Samples\OPG\Appendixes folder on the Office 2000 Developer CD-ROM. I'm sorry, I don't have a copy of this document.
     
  3. Thank you Joe for your prompt replay, I have applied the locale identifier to the connection string but unfortunately it didn’t work, still showing unreadable characters.

    Code:
    Private _Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|SeaData.mdb;Locale Identifier=1033;"
    By the way, this behavior only happen when I deploy the web application to the host server, in my development machine it is working fine.

    Any other help will be too much appreciated.
     
  4. There is something in your local setup that is enabling this to work and I suspect it will be related to the regional settings specified in your windows control panel. I also think it's likely the DASP web servers are configured with an en-US configuration so with this in mind, it would be a good idea to check your local regional settings. If you find something other than en-US, try changing your settings to this locale to see if you can reproduce the same problem locally. If you're able to reproduce the issue in development, you definitely stand a better chance of finding the solution.

    EDIT: another thing is I've just noticed is that you tried locale 1033 in the connection string which I think corresponds to the en-US locale however if I understand your first post correctly, the data in your access db is stored in the language Arabic. If that's the case it might be a good idea to try one of the Arabic locale Ids in the connection string too e.g. 1025 (Arabic - Saudi Arabia) http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx
     
  5. Still not working.

    Joe, there is something I didn’t mention because I thought it is irrelevant , when I display data from different database (MS Access database created using newer version other than Access 97, like MS Access 2007) Arabic characters are displayed in right format

    http://www.arbpost.com/sandooq/display_memname.aspx

    Also I cannot convert the database to newer version of MS Access because I don’t have control over the database; it is for a client which is located in different city. Also the client is using client server application for data transactions, the application written in ms access 97. He only uploads the database to the host server and customers using it for read only purposes.

    Thank you.


    Also I mention that there is nothing wrong with the database, because the arabic characters are showing perfectly in my development environment.

    I will still search for a solution, if you find anything that can help solve this issue, Please let me know.
     

Share This Page