From: "siteshwar at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: libc-locales@sources.redhat.com
Subject: [Bug localedata/14257] New: setlocale(LC_CTYPE, NULL) causes undesired side effects
Date: Sat, 16 Jun 2012 17:38:00 -0000 [thread overview]
Message-ID: <bug-14257-716@http.sourceware.org/bugzilla/> (raw)
http://sourceware.org/bugzilla/show_bug.cgi?id=14257
Bug #: 14257
Summary: setlocale(LC_CTYPE, NULL) causes undesired side
effects
Product: glibc
Version: 2.14
Status: NEW
Severity: normal
Priority: P2
Component: localedata
AssignedTo: unassigned@sourceware.org
ReportedBy: siteshwar@gmail.com
CC: libc-locales@sources.redhat.com
Classification: Unclassified
I have written following program to reproduce side effect :
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main()
{
setlocale(LC_ALL,"");
//This will cause side effect
const char * c = setlocale(LC_CTYPE, NULL);
printf("%s\n", c);
while (!feof(stdin))
{
wint_t t = fgetwc(stdin);
wchar_t t1 = static_cast<wchar_t>(t);
putwc(t1, stdout);
}
}
When I try to input unicode characters I get garbage characters in output.
[situ@juggernaut bugs]$ ./a.out
测试
K�
If I remove call to setlocale(LC_CTYPE, NULL) output is fine.
[situ@juggernaut bugs]$ ./a.out
测试
测试
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
next reply other threads:[~2012-06-16 17:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-16 17:38 siteshwar at gmail dot com [this message]
2012-06-16 17:49 ` [Bug localedata/14257] " schwab@linux-m68k.org
2014-06-18 5:17 ` fweimer at redhat dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-14257-716@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=libc-locales@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).