From owner-freebsd-questions@freebsd.org Tue Oct 13 09:53:48 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C48CDA120AD for ; Tue, 13 Oct 2015 09:53:48 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay101.isp.belgacom.be (mailrelay101.isp.belgacom.be [195.238.20.128]) by mx1.freebsd.org (Postfix) with ESMTP id 5B84512FD for ; Tue, 13 Oct 2015 09:53:48 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=on0vsgdz1NEtXcMZlQwg/MwbIQQ3jhei9UjQb9HCs8o= c=1 sm=2 a=6I5d2MoRAAAA:8 a=VkvU0GY0MCPzbcmJyy0A:9 a=CjuIK1q_8ugA:10 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BJIgCq0xxW/zhosVtdgyaBMw+/d4MTggp5BAICgT08EQEBAQEBAQGBCkEBAQMCg18BAQQnExwjEAsYCSUPKh4ZiDIBwFoBAQEBAQUBAQEBHotzhQ0HF4QXAQSWFopjgi9igRONMItcgQ83LIQEPDOELTU2gVkBAQE Received: from 56.104-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.104.56]) by relay.skynet.be with ESMTP; 13 Oct 2015 11:53:47 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id t9D9rkO4002308; Tue, 13 Oct 2015 11:53:46 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Tue, 13 Oct 2015 11:53:46 +0200 From: Tijl Coosemans To: freebsd-questions@freebsd.org Cc: kora Subject: Re: How to get libiconv on FreeBSD 10 convert utf-8 -> wchar_t ? Message-ID: <20151013115346.191326b2@kalimero.tijl.coosemans.org> In-Reply-To: <1444728578150-6044683.post@n5.nabble.com> References: <1443688672992-6042436.post@n5.nabble.com> <20151001212047.1f79e315@kalimero.tijl.coosemans.org> <1444723053047-6044663.post@n5.nabble.com> <1444728578150-6044683.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 09:53:48 -0000 On Tue, 13 Oct 2015 02:29:38 -0700 (MST) kora via freebsd-questions wrote: > Hi there, > I solved it. > I didn't notice that wchar_t is system dependent ! > > I wrote a helpermethod to return the correct wchar_t "tocode" / "fromcode" > input for the iconv_open(). > Using it now works. > > > #define WCHAR_32_LE "UTF-32LE" > #define WCHAR_32_BE "UTF-32BE" > #define WCHAR_16_LE "UTF-16LE" > #define WCHAR_16_BE "UTF-16BE" Yes, FreeBSD wchar_t is not UTF-32. If you are using UTF-32 now be aware that functions like wprintf may not work. You may want to use char32_t instead of wchar_t to prevent programming errors.