Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am writing an application(C#) for a specific Character like science symbol(μo).In Oracle DB store properly. This application involves using DataAdapter, OLEDB Connection (oracle 11g)and the DataSet. when i am displaying data in UI. Instead of displaying the correct characters the application displays æo ("æo"). Thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 8-Aug-14 3:52am    
You can display every character which has visible glyph. None of them are too "special". :-)
—SA

Hi,

Its a clear problem of character encoding.

how to solve it : change the AppDomain culture to which the character exists. ref
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.defaultthreadcurrentuiculture(v=vs.110).aspx[^]

but if you want to stay in same culture but still want to show those character then change the encoding ref : http://msdn.microsoft.com/en-us/library/ms404377(v=vs.110).aspx[^]

Chose your required encoding.

How to use encoding : http://stackoverflow.com/questions/5864272/understanding-text-encoding-in-net[^]
 
Share this answer
 
Comments
vbhorhari 8-Aug-14 3:53am    
Following is my code to fetch data from DB.
using (OracleConnection cn = new OracleConnection(connectionString))
{
using (OracleCommand cmd = new OracleCommand(commandText, cn))
{
OracleDataAdapter da = new OracleDataAdapter();
cmd.Connection = cn;
cmd.InitialLONGFetchSize = 1000;
cmd.CommandType = CommandType.StoredProcedure;
foreach (var param in parameters)
{
cmd.Parameters.Add(param.Item1, OracleDbType.Varchar2).Value = param.Item3;


}
da.SelectCommand = cmd;
da.Fill(dt);
}
}
after fill dt, I have checked dt.
It is showing wrong character "æo".
Suvabrata Roy 8-Aug-14 3:57am    
set the encoding at the control which you bind the DataTable
vbhorhari 8-Aug-14 4:36am    
How to encode?
Suvabrata Roy 8-Aug-14 4:54am    
you are not required to encode anything you need set the Encoding type
ref : http://stackoverflow.com/questions/12056030/c-sharp-datagridview-unicode-character-encoding
Sergey Alexandrovich Kryukov 8-Aug-14 3:55am    
Basically, it's correct, but the last link is not very good. It's better to read about Unicode in Wikipedia and/or Unicode.org.
I voted 4, if you don't mind.
—SA
Set the webclient encoding to UTF8.

client.Encoding = System.Text.Encoding.UTF8;


Please refer this link[^] too



Happy Coding :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900