Multilingual Data Problem in Excel Sheet


I am facing problem while exporting arabic/ multilingual text from data base to excel file. in excel file i am getting junk data. We are using Globalization in web.config fileencoding =“iso-8859-1” and we are using sql server for storing the data. For Multilingual data we use nvarchar. We are inserting values using N’<unicode text …>’ and when we export the value in excel it is giving junk character even though i am converting data in UTF-8. Please give me some example for this kind of solution.



Hi Ashish,

Are all characters converted to junk text? Please convert your text in Unicode.

How do you export string to an Excel file?

If your code like following sample code:


Please make stringData is Unicode string.


Hi laurence,

Yes laurence all the charactes are converted to junk text.

My code is like cell.PutValue(converttoUnicode(string))

and converttoUnicode function is like

Function convertToUTF(ByVal strText As String) As String

Dim bytes() As Byte

Dim bytes1() As Byte

Dim bytes2() As Char

’ get unicode string as bytes

bytes = System.Text.Encoding.unicode.GetBytes(strText)

’ encode byte array of unicode-strings into UTF-8

bytes1 = System.Text.Encoding.Convert(System.Text.Encoding.UTF8, System.Text.Encoding.Unicode, bytes)

bytes2 = System.Text.Encoding.Unicode.GetChars(bytes1)

Dim i As Integer
Dim myString As String
For i = 0 To UBound(bytes2)
myString = myString & bytes2(i)
convertToUTF = myString
End Functio

Still the text appear as junk charcter


Why converting the characters to UTF? If your text are unicode, just put them to cells.

Could you please try the following code and post the generated file here?

Dim myText as string = “…” ’ Put an arabic string to myText

Dim ExcelObj as Excel = new Excel()


Hi Laurence,

I tried the way you are suggested to me…

but the result are still the same junk data…

i think that’s becase i am using nvarchar datatype for that field its changes my data in to some character… according to website encoding setting and my encoding setting is ISO…




Could you please manually put some arabic characters in an Excel file and post it here? I cannot input arabic text in my machine.

Thank you.