public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8
@ 2007-10-21 21:50 siegerstein at pochta dot ru
2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: siegerstein at pochta dot ru @ 2007-10-21 21:50 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]
Here is incorrect text formating with using cout() with setw() in UNICODE
(UTF-8)
Two text: first in English - correct formating, second - russian in UTF-8 -
incorrect.
#include <iostream>
#include <iomanip>
int main() {
std::cout.setf(std::ios::left);
std::cout.fill('_');
std::cout << std::setw(15) << "Mixer" << std::setw(15) << "Device" <<
std::setw(15) << "Recording" <<
std::setw(15) << "Active" << std::setw(15) <<
"Stereo" << std::setw(15) << "Current" << std::endl;
std::cout << std::setw(15) << "Channel" << std::setw(15) <<
"Available" << std::setw(15) << "Source" <<
std::setw(15) << "Source" << std::setw(15) <<
"Device" << std::setw(15) << "Level" << std::endl;
std::cout << std::endl;
// Russian text in UTF-8
// Not correct formating text....
std::cout << std::setw(15) << "Êàíàë" << std::setw(15) << "Äîñòóïíîñòü"
<< std::setw(15) << "Èñòî÷íèê" <<
std::setw(15) << "Àêòèâíîñòü" << std::setw(15) <<
"Ñòåðåî" << std::setw(15) << "Òåêóùèé" << std::endl;
std::cout << std::setw(15) << "ìèêøåðà" << std::setw(15) <<
"óñòðîéñòâà" << std::setw(15) << "çàïèñè" <<
std::setw(15) << "èñòî÷íèêà" << std::setw(15) <<
"óñòðîéñòâî" << std::setw(15) << "óðîâåíü" << std::endl;
return 0;
}
$ g++-4.2.2 bug.cpp -o bug
RESULT:
Mixer__________Device_________Recording______Active_________Stereo_________Current________
Channel________Available______Source_________Source_________Device_________Level__________
Êàíàë_____ÄîñòóïíîñòüÈñòî÷íèêÀêòèâíîñòüÑòåðåî___Òåêóùèé_
ìèêøåðà_óñòðîéñòâàçàïèñè___èñòî÷íèêàóñòðîéñòâîóðîâåíü_
--
Summary: incorrect text formating in "std::cout" with UTF-8
Product: gcc
Version: 4.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: siegerstein at pochta dot ru
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
@ 2007-10-27 20:26 ` siegerstein at pochta dot ru
2007-10-27 20:28 ` siegerstein at pochta dot ru
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: siegerstein at pochta dot ru @ 2007-10-27 20:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from siegerstein at pochta dot ru 2007-10-27 20:26 -------
Can any body comment this bug?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
@ 2007-10-27 20:28 ` siegerstein at pochta dot ru
2007-10-28 9:53 ` pcarlini at suse dot de
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: siegerstein at pochta dot ru @ 2007-10-27 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from siegerstein at pochta dot ru 2007-10-27 20:27 -------
Created an attachment (id=14416)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14416&action=view)
bug.cpp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
2007-10-27 20:28 ` siegerstein at pochta dot ru
@ 2007-10-28 9:53 ` pcarlini at suse dot de
2010-02-21 1:05 ` manu at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pcarlini at suse dot de @ 2007-10-28 9:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pcarlini at suse dot de 2007-10-28 09:53 -------
Cout & co by default aren't converting streams, they are synced char-by-char
with stdio, therefore cannot be expected to work with UTF-8 in any meaningful
way. If you call sync_with_stdio(false) at the beginning of your program and
then imbue the proper locale, things will work with any encoding >= 0 locale,
UTF-8 or other, if you make sure to use wchar_t as your internal representation
(we do not provide char <-> char codecvts).
Note that a lot about locale and streams is implementation defined in the
current standard and we consider our design choices (sync with stdio by
default, required in the standard, then a converting stream if syncing is
disabled) only a very good compromise.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
` (2 preceding siblings ...)
2007-10-28 9:53 ` pcarlini at suse dot de
@ 2010-02-21 1:05 ` manu at gcc dot gnu dot org
2010-02-21 1:31 ` paolo dot carlini at oracle dot com
2010-02-21 1:32 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21 1:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from manu at gcc dot gnu dot org 2010-02-21 01:05 -------
I understand that this is not a bug, so closing. Please Paolo, reopen if I am
mistaken.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
` (3 preceding siblings ...)
2010-02-21 1:05 ` manu at gcc dot gnu dot org
@ 2010-02-21 1:31 ` paolo dot carlini at oracle dot com
2010-02-21 1:32 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-21 1:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2010-02-21 01:31 -------
Reopen...
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/33852] incorrect text formating in "std::cout" with UTF-8
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
` (4 preceding siblings ...)
2010-02-21 1:31 ` paolo dot carlini at oracle dot com
@ 2010-02-21 1:32 ` paolo dot carlini at oracle dot com
5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-02-21 1:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2010-02-21 01:31 -------
*** This bug has been marked as a duplicate of 35353 ***
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33852
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-21 1:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
2007-10-27 20:28 ` siegerstein at pochta dot ru
2007-10-28 9:53 ` pcarlini at suse dot de
2010-02-21 1:05 ` manu at gcc dot gnu dot org
2010-02-21 1:31 ` paolo dot carlini at oracle dot com
2010-02-21 1:32 ` paolo dot carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).