Microsoft KB Archive/937465

= Certain code functions may not behave as expected when you use Unicode information in Visual C++ =

Article ID: 937465

Article Last Modified on 6/21/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Express Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Team Edition for Database Professionals
 * Microsoft Visual Studio 2005 Team Edition for Software Architects
 * Microsoft Visual Studio 2005 Team Edition for Software Developers
 * Microsoft Visual Studio 2005 Team Edition for Software Testers
 * Microsoft Visual Studio 2005 Team Foundation Server
 * Microsoft Visual Studio 2005 Team Suite
 * Microsoft Visual Studio 2005 Team Foundation
 * Microsoft Visual Studio 2005 Team System Test Edition

-



SYMPTOMS
Consider the following scenario. You try to use certain code functions together with Unicode information in an application. The application was built by using Microsoft Visual C++. In this scenario, the functions may not behave as expected. Additionally, the functions may behave differently in an application that is built by using Microsoft Visual Studio .NET 2003 than they do in an application that is built by using Visual Studio 2005. For example, when you try to use the fstream.open function to open a file stream by using Visual Studio 2005, the function may not work. Additionally, the file stream may not be opened.



CAUSE
This problem occurs because Unicode information is handled differently in Visual Studio 2005 than it is in Visual Studio .NET 2003. Visual Studio 2005 provides better support for Unicode information. However, you must specify the locale to use when you work with Unicode information in Visual Studio 2005.



RESOLUTION
To resolve this problem, call the setlocale function to set the locale for the application. You must do this before you call the function that uses Unicode information. For example, add the following line of code to the application to use the Japanese locale. std::locale::global(std::locale(&quot;japanese&quot;));



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Keywords: kbcode kbbug kbexpertiseinter kbexpertisebeginner kbtshoot kbprb KB937465

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.