CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 16

Threaded View

  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    So how do you compare strings in MFC/Unicode build?

    Hello everyone:


    I just stumbled upon a bug in MFC that I could not believe my eyes still existed! It is no secret that pretty much every computer program heavily relies on string comparison, and quite a few of those string comparisons are case-insensitive. So for those of us who use MFC, we probably rely on CStringT ATL template class, and CString::CompareNoCase() method to do the work of string comparison. So, guess what, it seems to have one nasty bug when comparing any non-English strings in a Unicode-built project.

    I made a small sample project (using a version of MFC, as early as I could find) to demonstrate the issue. This small example will work fine for any English string, but it seems to fail miserably for any foreign characters. (We have a Russian guy at work. He tested it and told me that it didn't work for sure with the Cyrillic alphabet.) I tried building it with the latest version of VS2010 with the same result.

    So my question to you, what APIs do you use to work with strings? And is there at least something (half-way) reliable that is written by Microsoft these days?
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured