From owner-freebsd-standards@FreeBSD.ORG Sun Aug 29 20:00:03 2010 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85A061065695 for ; Sun, 29 Aug 2010 20:00:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 586118FC1B for ; Sun, 29 Aug 2010 20:00:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7TK032J035223 for ; Sun, 29 Aug 2010 20:00:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o7TK03IA035222; Sun, 29 Aug 2010 20:00:03 GMT (envelope-from gnats) Resent-Date: Sun, 29 Aug 2010 20:00:03 GMT Resent-Message-Id: <201008292000.o7TK03IA035222@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yuri Karaban Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A3611065697 for ; Sun, 29 Aug 2010 19:53:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 09CDB8FC0C for ; Sun, 29 Aug 2010 19:53:16 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TJrFGp050172 for ; Sun, 29 Aug 2010 19:53:15 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o7TJrFgZ050171; Sun, 29 Aug 2010 19:53:15 GMT (envelope-from nobody) Message-Id: <201008291953.o7TJrFgZ050171@www.freebsd.org> Date: Sun, 29 Aug 2010 19:53:15 GMT From: Yuri Karaban To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: standards/150093: C++ std::locale support is broken X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2010 20:00:03 -0000 >Number: 150093 >Category: standards >Synopsis: C++ std::locale support is broken >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 29 20:00:02 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Yuri Karaban >Release: 8.1-RELEASE >Organization: >Environment: >Description: Standard C++ library, libstdc++, compiled with "generic" locale support. So only "C" and "POSIX" locales are supported. Setting any other locale will throw the runtime_error exception "locale::facet::_S_create_c_locale name not valid". Though locale name is valid and works with setlocale(3). On Linux libstdc++ is using "gnu" locale configuration. Which takes use of newlocale(3)/uselocale(3)/freelocale(3)/... POSIX calls. FreeBSD does not support these calls so it is not possible to use "gnu" configuration. Since C++ standard allow several locale instances to coexists simultaneously, it must be not possible to implement C++ locales in terms of setlocale(3). There are two possible solutions: 1. Implement locale related functions in FreeBSD C Library. This option is preferred: supporting standard functions is always a plus and having these function it is possible to use existing locale model in libstdc++. 2. Implement custom locale support for FreeBSD in libstdc++. Advantage that standard C library would be untouched. But on the other hand, there are many disadvantages (to create libstdc++ locale model from scratch; difficult to implement in terms of setlocale, means use of some hacks with libc internals). PS. Locale support is really important. C++ programs which use locale is unusable on FreeBSD and there is no workaround. >How-To-Repeat: Compile and run following C++ code: #include int main() { std::locale("en_US.UTF-8"); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: