Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

fputwc(fputc)无法向stdout输出非英文 #56

@mingkuang-Chuyu

Description

@mingkuang-Chuyu

如何重现此问题?

setlocale(0, ".936");
fputwc(L'', stdout);
wprintf(L"");
std::cout << "呵呵" << std::endl;

影响范围
所有所有的VC-LTL版本均受影响,但是 4.0.2.5 Beta(包含)以后的版本影响更大。
fputwc/fputc
wprintf/printf
std::cout
等跟 stdout 输出有关操作均可能受到影响。但是普通文件流并不受此影响。

问题原因
msvcrt.dll自身缺陷,write函数不支持向stdout写入不完整的ANSI字符。

临时规避
使用 fputs,比如说 fputs("呵呵", stdout);,也可以开启 VC-LTL轻量模式,在轻量模式中 wprintf 能保证正常使用。

我们正在寻求最简单最完美的修复方案,同时欢迎大家提供解决方案。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions