Compare strings with non-English characters?

后端 未结 7 2109
再見小時候
再見小時候 2021-01-19 07:20

I need to compare strings for a search mechanism on a web site. I use C#. I tried two ways:

consultants.Where(x => 
    x.Description.ToLower().Contains(v         


        
7条回答
  •  囚心锁ツ
    2021-01-19 08:15

    What do you search on ? On an xml file, on a db4o file, on sql ? The character coding of your database is important. You can handle with it at xml setting its utf-coding; and db4o it is already safe works on object, on sql side you have to set the charachter encoding.

    if you database is holding values as char(50) or varchar(50) it may miss different characters, to hold different characters such you should use nchar, nvarchar at your sql-database. Do not forget to check your database character coding, even it is not much neccessary

提交回复
热议问题