warning C4819 (bad unicode char) building NSS on Win?

1,516 views
Skip to first unread message

Mike Pinkerton

unread,
Sep 25, 2014, 7:22:36 AM9/25/14
to Chromium-dev
Some of my students are trying to compile using windows8.1 and visual studio and are seeing this error message:

C:\Users\Zhiyu\src>ninja -C out\Debug chrome
ninja: Entering directory `out\Debug'
[61/17848] CC obj\third_party\nss\nss\...eebl\nss_static_avx.intel-gcm-wrap.obj
FAILED: ninja -t msvc -e environment.x86 -- "C:\Study\Chromium\depot_tools\win_t
oolchain\vs2013_files\VC\bin\cl.exe" /nologo /showIncludes /FC @obj\third_party\
nss\nss\lib\freebl\nss_static_avx.intel-gcm-wrap.obj.rsp /c ..\..\third_party\ns
s\nss\lib\freebl\intel-gcm-wrap.c /Foobj\third_party\nss\nss\lib\freebl\nss_stat
ic_avx.intel-gcm-wrap.obj /Fdobj\third_party\nss\nss_static_avx.c.pdb
c:\users\zhiyu\src\third_party\nss\nss\lib\freebl\intel-gcm.h : error C2220: war
ning treated as error - no 'object' file generated
c:\users\zhiyu\src\third_party\nss\nss\lib\freebl\intel-gcm.h : warning C4819: T
he file contains a character that cannot be represented in the current code page
 (936). Save the file in Unicode format to prevent data loss
[61/17848] ACTION Generating resources from resources/ash_resources.grd
ninja: build stopped: subcommand failed.
Any ideas?

--
Mike Pinkerton
Mac Weenie
pink...@google.com

Fumitoshi Ukai (鵜飼文敏)

unread,
Sep 25, 2014, 10:14:30 AM9/25/14
to pink...@chromium.org, Chromium-dev
http://dev.chromium.org/developers/how-tos/build-instructions-windows#TOC-Compilation-failures

Warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss
When you see this message, you may use Chinese, Japanese or Korean Windows, and uses DBCS code page.
To avoid this warning, you need to change your Windows system code page to English or another SBCS code page. You can do this by Control Panel - Regions - Administrative - Language for non-Unicode programs.
Note: chcp 65001 in cmd.exe doesn't solve this issue.
Note: If you use Bitlocker, you may want to back up your bitlocker key before changing system code page.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Mike Pinkerton

unread,
Sep 25, 2014, 10:28:32 AM9/25/14
to Fumitoshi Ukai (鵜飼文敏), Chromium-dev
Thank you, I'll pass that along to them.

Scott Graham

unread,
Sep 25, 2014, 12:06:15 PM9/25/14
to pink...@chromium.org, Chromium-dev
We should probably also just stick to [32-126] in code to avoid this problem. It looks like it's just the (R) and (TM) characters in a comment in that header in this case.


--

Yuta Kitamura

unread,
Sep 25, 2014, 10:39:40 PM9/25/14
to Fumitoshi Ukai, pink...@chromium.org, Chromium-dev
The most annoying part of this issue is, I think, that we have to change the system locale, not the user locale. Changing the user locale alone is not enough.

As far as I know, this cannot be worked around. I think it's one of the places where VC toolchains are fundamentally broken, and Microsoft does not seem happy to fix that :~(

(Microsoft would like to require BOM for UTF-8 sources, but UTF-8 BOM is pretty silly stuff IMO, because there's really no byte order in UTF-8. See https://connect.microsoft.com/VisualStudio/feedback/details/888437/it-is-impossible-to-use-utf-8-without-bom-in-source-files)

Victor Khimenko

unread,
Sep 26, 2014, 5:07:29 AM9/26/14
to Yuta Kitamura, Fumitoshi Ukai, Mike Pinkerton, Chromium-dev
On Fri, Sep 26, 2014 at 6:37 AM, Yuta Kitamura <yu...@chromium.org> wrote:
The most annoying part of this issue is, I think, that we have to change the system locale, not the user locale. Changing the user locale alone is not enough.

As far as I know, this cannot be worked around. I think it's one of the places where VC toolchains are fundamentally broken, and Microsoft does not seem happy to fix that :~(

(Microsoft would like to require BOM for UTF-8 sources, but UTF-8 BOM is pretty silly stuff IMO, because there's really no byte order in UTF-8. See https://connect.microsoft.com/VisualStudio/feedback/details/888437/it-is-impossible-to-use-utf-8-without-bom-in-source-files)

Perhaps we could teach git to add BOM on checkout and remove it on commit? Pretty silly thing to do, but to have no ability to use non-ASCII symbols even in comments in XXI century feels even sillier.

Hikki Hikigaya

unread,
Oct 1, 2015, 3:47:15 AM10/1/15
to Chromium-dev
A way to work around without setting system locale is to open the error file with Notepad++, select "Encoding -> Encode in UTF-8" and save it.
Reply all
Reply to author
Forward
0 new messages