<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - std::wcin cannot read a multibyte character sequence"
href="https://llvm.org/bugs/show_bug.cgi?id=24929">24929</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::wcin cannot read a multibyte character sequence
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kariya_mitsuru@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Please see the sample code below.
========================= sample code =========================
#include <iostream>
#include <locale>
int main()
{
std::wcin.imbue(std::locale("en_US.UTF-8"));
wchar_t c;
if (std::wcin >> c) {
std::cout << std::hex << static_cast<int>(c) << '\n';
} else {
std::cout << "error!\n";
}
}
========================= sample code =========================
=================== standard input (utf-8) ===================
ü(u umlaut)
=================== standard input (utf-8) ===================
========================= output =========================
error!
========================= output =========================
cf. <a href="http://melpon.org/wandbox/permlink/1gZAq81rbJMvGm0p">http://melpon.org/wandbox/permlink/1gZAq81rbJMvGm0p</a>
I think that the character "ü"(u umlaut) is a valid character on
the locale en_US.UTF-8, so an output should be
======================= desired output =======================
fc
======================= desired output =======================
Note that wifstream can read a multibyte sequence correctly.
cf. <a href="http://melpon.org/wandbox/permlink/9reHs5foneZCi2RF">http://melpon.org/wandbox/permlink/9reHs5foneZCi2RF</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>