how to convert hexa data into arabic languages???

my application should take a data from sql server and chec if it is arabic or english and then store it in the database ...

everything is working unless the arabic characters which displays in reverse orders ..

so my logic is

to checkfirst if the coming data is numeric(this is because I translate the arabic into hexa)

so if it is numeric then it is arabic so should to convert into arabic and store in database table ...

if not numeric (not arabic) store it directly in database ..

I am using these functions to do every thing ...

public string Hex2Arabic(string msg)

{

long i;

string hex="";

string c;

string correct="";

hex = msg;

if (((hex.Length % 4) != 0))

{

Response.Write("hexa to arabic bad length, it is not divided by 4");

}

while ((hex.Length > 0))

{

c = hex.Substring(0, 4);

i = Convert.ToInt32(c, 16);

correct =(correct+ (char)i);

hex = hex.Substring((hex.Length - (hex.Length - 4)));

}

return correct;

}

public bool IsNumeric(string Nombre)

{

int i=0;

int nb=0;

bool ok=false;

char[] tabNombre;

char[] unNb;

tabNombre=Nombre.ToCharArray(0,Nombre.Length);

for (i=0;i<Nombre.Length;i++)

{

ok=false;

while ((nb<10)&&(ok==false))

{

unNb=Convert.ToString(nb).ToCharArray(0,1);

if (tabNombreIdea==unNb[0])

{

ok=true;

nb=0;

}

else

{

if ((i==0)&&(tabNombreIdea=='-'))

{

ok=true;

nb=0;

}

else

{

ok=false;

nb++;

}

}

}

}

return ok;

}

and this is the call (using Inet the data come from another application)

if (IsNumeric(Request.QueryString["name"]))

{

string correct= ReverseStringWords(Hex2Arabic(Request.QueryString["name"]));

SqlCommand com=new SqlCommand("insert into dest (mapid,name,age,gender,number,dob) values ('"+Request.QueryString["id"]+"','"+correct+"','"+Request.QueryString["age"]+"','"+Request.QueryString["gender"]+"','"+Request.QueryString["number"]+"','"+Request.QueryString["dob"]+"')",sqlConnection1);

com.Connection=sqlConnection1;

sqlConnection1.Open();

if (com.ExecuteNonQuery()!=0)

{

Response.Write("0");

Response.End();

}

sqlConnection1.Close();

}

else

{

SqlCommand com=new SqlCommand("insert into dest (mapid,name,age,gender,number,dob) values ('"+Request.QueryString["id"]+"','"+Request.QueryString["name"]+"','"+Request.QueryString["age"]+"','"+Request.QueryString["gender"]+"','"+Request.QueryString["number"]+"','"+Request.QueryString["dob"]+"')",sqlConnection1);

com.Connection=sqlConnection1;

sqlConnection1.Open();

if (com.ExecuteNonQuery()!=0)

{

Response.Write("0");

Response.End();

}

sqlConnection1.Close();

}

I want to store the arabic chars in correctly ... but always it is stored in reverse order ..

can any body help me doing that ..



Answer this question

how to convert hexa data into arabic languages???

  • Winanjaya

    hi .... what is wrong nobody can help me...
  • how to convert hexa data into arabic languages???