From owner-freebsd-i18n@FreeBSD.ORG Thu Mar 6 07:29:16 2008 Return-Path: Delivered-To: freebsd-i18n@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A8DF1065672 for ; Thu, 6 Mar 2008 07:29:16 +0000 (UTC) (envelope-from le_briocheur@yahoo.fr) Received: from postfix1-g20.free.fr (postfix1-g20.free.fr [212.27.60.42]) by mx1.freebsd.org (Postfix) with ESMTP id ED1088FC1D for ; Thu, 6 Mar 2008 07:29:15 +0000 (UTC) (envelope-from le_briocheur@yahoo.fr) Received: from smtp7-g19.free.fr (smtp7-g19.free.fr [212.27.42.64]) by postfix1-g20.free.fr (Postfix) with ESMTP id D8A9E238C591 for ; Thu, 6 Mar 2008 08:00:18 +0100 (CET) Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id 0AA0A3227FD for ; Thu, 6 Mar 2008 08:00:17 +0100 (CET) Received: from [127.0.0.1] (wmh38-1-82-225-141-62.fbx.proxad.net [82.225.141.62]) by smtp7-g19.free.fr (Postfix) with ESMTP id CAAB33227F9 for ; Thu, 6 Mar 2008 08:00:16 +0100 (CET) Message-ID: <47CF9683.9040906@yahoo.fr> Date: Thu, 06 Mar 2008 08:00:19 +0100 From: chris User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: freebsd-i18n@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080306-0, 06/03/2008), Outbound message X-Antivirus-Status: Clean Subject: convert greek chars to unicode problem (mbtowc) X-BeenThere: freebsd-i18n@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD Internationalization Effort List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2008 07:29:16 -0000 Hello, i have a problem with the C code below (code + output) the goal is to convert the "PI" greek character to unicode the locale dependent representation of PI letter is byte 0xD0 (ISO 8859-7) the resulting unicode character should be 0x03A0 i dont understand why the function returns the original char without conversion... maybe someone can see what is wrong in this code ? by the way : i use a fresh 6.2 installation on i386 any help greatly welcome ! Best Regards, Chris #include #include #include #include int main( int argc, char** argv) { char mb = '\xD0'; char* loc = NULL; int i; wchar_t wc = 0; loc = setlocale( LC_CTYPE, "el_GR.ISO8859-7" ); if ( loc != NULL ) fprintf(stderr,"locale changed to %s\n",loc); else fprintf(stderr,"locale NOT changed\n"); mbtowc(0,0,0); i = mbtowc( &wc, &mb, 1 ); if ( i < 0 ) fprintf(stderr,"conversion error\n"); else fprintf(stderr,"conversion(%d) : %08x\n",i,wc ); return 0; } The OUTPUT is : locale changed to el_GR.ISO8859-7 conversion(1) : 000000d0