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

This article has been archived. It is offered "as is" and will no longer be updated.
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("japanese"));
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Properties

Article ID: 937465 - Last Review: 01/16/2015 08:16:00 - Revision: 2.0

  • 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
  • kbnosurvey kbarchive kbcode kbbug kbexpertiseinter kbexpertisebeginner kbtshoot kbprb KB937465
Feedback