delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/08/16:48:59

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <061d01ca1866$0f881db0$2e985910$@com>
References: <061d01ca1866$0f881db0$2e985910$@com>
Date: Sat, 8 Aug 2009 21:48:38 +0100
Message-ID: <416096c60908081348v45812d88y5b6cc9be9635923b@mail.gmail.com>
Subject: Re: converting to wide characters
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

2009/8/8 Tony Lewis:
> According to the documentation, passing an empty string to iconv denotes
> locale dependent character encoding. This leads me to conclude that by
> default on cygwin:
>
> cd = iconv_open("UTF-16LE", "");
>
> should produce the same encodings as:
>
> cd = iconv_open("UTF-16LE", "ISO-8859-1");

Nope, the default codepage on Cygwin is your Windows' default "ANSI"
codepage, i.e. probably 1252.

> but it doesn't for characters in the range 0x80 to 0x9f. Is there a way to
> set my locale within cygwin so that "" means "ISO-8859-1" to iconv_open?

Cygwin 1.7's setlocale() reads the standard environment variables:
LC_ALL, LC_CTYPE, LANG. (On Cygwin 1.5 there's a codepage setting in
the CYGWIN variable, but I don't think that affects setlocale().)

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019