Compare strings with non-English characters?

后端 未结 7 2114
再見小時候
再見小時候 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:10

    Here is an introduction to the character set problem by Joel Spolsky. A very interesting read.

    In short, the web page needs to tell you what character set it is using at the very beginning of the page. C# is using unicode (In UTF-16 encoding as standard) for strings, a explanation what that means can you find here in csharp in depth

    Hope this will help you.

提交回复
热议问题