strings comparison

  • Thread starter Thread starter Dariusz Tomon
  • Start date Start date
D

Dariusz Tomon

Hello

I'm trying to compare two strings:

1. retrieved from custom xmlplaceholder (Microsoft CMS):
zrodlo = fact.Placeholders["kategoria2"] as XmlPlaceholder;

esc_kat2 = Server.HtmlEncode(zrodlo.XmlAsString);

esc_kat2 = esc_kat2.Replace("<","");

esc_kat2 = esc_kat2.Replace(">","");

esc_kat2 = esc_kat2.Replace("/Zones","");

esc_kat2 = esc_kat2.Replace("/Zone","");

esc_kat2 = esc_kat2.Replace("Zones","");

kategoria2 = esc_kat2.Replace("Zone","");


String kategoria2 has my nationals characters translated into unicode and
looks like this:

"orzecznictwo do celów pozarentowych"

2. The second one is retrieved from SQL database:

selectCmd = "select * from urzond_main order by id";

myCommand = new SqlCommand(selectCmd, myConnection);

myConnection.Open();

myReader = myCommand.ExecuteReader();



while (myReader.Read())

{

kategoria1 = myReader.GetSqlString(1).ToString();

}



String kategoria1 has original national characters without being
translated into unicode:

orzecznictwo do celów pozarentowych



I cannot compare these strings 'cos they are different.

What is the best advice? Please give some code portion with an advice.

Best Regards



Darek
 
Darek,

(sent accidently to the emailaddress first)

I don't believe in "best methods" otherwise there was a standard method.

It is your decission how something is the same. If it is needed that:

Walensa has to be the same as Walesa, than it is probably very difficult to do if for that is not somehwere a Polish routine on the InterNet.

However if it has to be Walesa than you can look for this methods.

http://msdn.microsoft.com/library/d...fsystemtextencodingclassgetencodingtopic1.asp


Here some links to used code pages.

Unicode
http://www.geocities.com/Athens/Academy/4038/graph/fontset.htm#b

OS systems

http://www.microsoft.com/globaldev/reference/oslocversion.mspx

I hope this helps a little bit?

Cor
 
Back
Top