Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: String literals are misinterpreted by the Visual C++ compiler in Visual Studio 2008 Service Pack 1 when the string literals use UTF-8 encoding and contain Asian characters


Symptoms

Consider the following scenario:
  • You create a Visual C++ project in Microsoft Visual Studio 2008 Service Pack 1 (SP1).
  • A file in the project has narrow string literals. These string literals contain Asian characters and are not prefixed with the letter "L."
  • The string literals use UTF-8 encoding.
In this scenario, when you compile the project, the string literals are misinterpreted by the compiler. Additionally, you encounter one of the following issues:
  • The compile operation succeeds. However, the string literals are displayed incorrectly in the generated application. Additionally, you may also receive the following warning messages when you compile the project:
    warning C4566: character represented by universal-character-name 'xx’ cannot be represented in the current code page.
  • The compile operation fails. Additionally, you may receive the following error message when you compile the project:
    error C2078: too many initializers

↑ Back to the top


Cause

This problem occurs because the compiler assumes that the file in the "Symptoms" section has MBCS encoding. Because of this behavior, the compilerincorrectly translates the file.

↑ Back to the top


Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

You must have Visual Studio 2008 Service Pack 1 (SP1) installed to apply this hotfix.

Restart requirement

You do not have to restart the computer after you apply this hotfix if no instance of Visual Studio is being used.

Hotfix replacement information

This hotfix does not replace other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
File nameFile versionFile sizeDateTimePlatform
C1.dll15.0.30729.4987678,72009-Mar-201010:18x86
C1xx.dll15.0.30729.49872,204,48809-Mar-201010:18x86
C1xx.dll15.0.30729.49872,215,24009-Mar-201010:18x86
C1xx.dll15.0.30729.49872,339,65609-Mar-201010:18x86
C1xx.dll15.0.30729.49872,505,55209-Mar-201010:18x86
C1xx.dll15.0.30729.49872,891,59209-Mar-201010:18x64

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More Information

To resolve the error in compiler, install this hotfix and then save the file together with a byte-order mark. Additionally, add the following "pragma" directive just before the string literals in the source file.

#pragma execution_character_set("utf-8")
Note The "pragma" directive sets the translation unit for the source file until the "pragma" directive is replaced by another "pragma" directive.

↑ Back to the top


Keywords: kbexpertiseadvanced, kbnotautohotfix, kbhotfixdev, kbsurveynew, kbqfe, kbhotfixserver, kb

↑ Back to the top

Article Info
Article ID : 980263
Revision : 4
Created on : 3/30/2017
Published on : 3/30/2017
Exists online : False
Views : 297