I have a strange string looks like this on the database
"இரண்டு வருடங்கள்"
On browser it displays correctly like this
"இரண்டு வருடங்கள்" (this is the correct way)
The problem is I cant search for phrases properly on database as its stored in a weird way. How do I convert to proper unicode like this "இரண்டு வருடங்கள்" and store?
//The database field is properly set to NVarchar and if I directly store the correct value it stays like that on database, so the problem is not there.
I need to find a way to convert the source string properly from that weird unicode format to proper Unicode and store on database.
note: I have tried these guides and didnt work.
Convert Unicode string into proper string
C# Convert string from UTF-8 to ISO-8859-1 (Latin1) H
My insert code looks like this:
string insertSql = @"INSERT INTO Importer (Heading, Url) VALUES (@0, @1)";
using (SqlCommand insertCmd = new SqlCommand(insertSql, con))
{
insertCmd.Parameters.AddWithValue("@0", heading);
insertCmd.Parameters.AddWithValue("@1", url);
insertCmd.ExecuteNonQuery();
}
Field is declared as:
[Heading] [nvarchar](500) NULL
Database is not a problem, I have tried insert the correct string and its being stored. The only problem is that weird formated Unicode string which is being stored like that, but when viewed on the browser it displays correctly.
You can try copy the string on a html file and view it on browser. It will show correctly, but when you view the source it will be in the wrong weird way.
Try creating a html file with this content and view on your browser and look at the source code as well.
"இரண்டு வருடங்கள்"