FIX: _mbslwr Does Not Handle International Characters

Last reviewed: January 15, 1998
Article ID: Q179284
The information in this article applies to:
  • The C Run Time (CRT) included with: - Microsoft Visual C++, 32-bit Editions, version 5.0

SYMPTOMS

The C run-time function _mbslwr is used to convert uppercase letters in a multibyte-character string to lowercase letters. This function fails to convert characters that are in the range of 128 to 255.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Visual Studio 97 service pack 1.

MORE INFORMATION

The following sample program demonstrates the problem:

   //Sample.cpp
   // Compiler Options:  none

   #include <stdio.h>
   #include <locale.h>
   #include <mbstring.h>

   int main()
   {
      printf("%s\n",setlocale(LC_ALL,"English_United States.1252") );
      unsigned char  c_Upper =  '\xD6' ;
                               //Capital O Umlaut character value=D6h.

      unsigned char  c_Lower =  '\xF6' ;
                              //Lower Case O Umlaut character value=F6h.

     printf(  "Before Conversion c_Upper=%Xh  c_Lower=%Xh\n",
                        c_Upper, c_Lower );
     _mbslwr(&c_Upper); // c_Upper should now be equal to c_Lower =F6h
     printf(  "After  Conversion c_Upper=%Xh  c_Lower=%Xh\n",
                        c_Upper, c_Lower );
     return 0;
   }

   Program output:

   English_United States.1252
   Before Conversion c_Upper=D6h  c_Lower=F6h
   After  Conversion c_Upper=D6h  c_Lower=F6h

   Expected output:

   English_United States.1252
   Before Conversion c_Upper=D6h  c_Lower=F6h
   After  Conversion c_Upper=F6h  c_Lower=F6h


Additional query words: VS97FixlistSP1 CString MakeLower
Keywords : CRTIss
Version : WINNT:5.0
Platform : winnt
Issue type : kbbug
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.