From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTHZz-00019u-TV for qemu-devel@nongnu.org; Wed, 04 Mar 2015 17:15:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTHZv-0005fc-PA for qemu-devel@nongnu.org; Wed, 04 Mar 2015 17:15:47 -0500 Received: from mail.univention.de ([82.198.197.8]:2265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTHZv-0005eE-Ga for qemu-devel@nongnu.org; Wed, 04 Mar 2015 17:15:43 -0500 Message-ID: <54F7840B.8010707@univention.de> Date: Wed, 04 Mar 2015 23:15:39 +0100 From: Philipp Hahn MIME-Version: 1.0 References: <1425478712-4146-1-git-send-email-gongxiaodong1@huawei.com> In-Reply-To: <1425478712-4146-1-git-send-email-gongxiaodong1@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v10] Support vhd type VHD_DIFFERENCING List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xiaodong Gong , stefanha@gmail.com, kwolf@redhat.com, arei.gonglei@huawei.com, rudy.zhangmin@huawei.com, jcody@redhat.com, cyliu@suse.com, petrutlucian94@gmail.com, ssdxiao@163.com Cc: Xiaodong Gong , qemu-devel@nongnu.org Hi, On 04.03.2015 15:18, Xiaodong Gong wrote: > @@ -157,6 +178,224 @@ static int vpc_probe(const uint8_t *buf, int buf_= size, const char *filename) .. > +static int vpc_decode_maxc_loc(BlockDriverState *bs, uint32_t data_len= gth) ... > + cd =3D g_iconv_open("ASCII", "UTF8"); ... > +static int vpc_decode_w2u_loc(BlockDriverState *bs, uint32_t data_leng= th) ... > + cd =3D g_iconv_open("ASCII", "UTF-16LE"); Please correct me if my understanding is wrong, but a hard-coded "ASCII" is AFAIK wrong, as it only contains the 7-bit characters. For the Linux kernel the file name is just a string of bytes, but when it gets displayed to the user, the bytes are converted to characters. The conversion depends on the locale used, which now-adays is most often UTF-8 (LANG=3Dde_DE.UTF-8, or more specifically LC_CTYPE), but some years back it was ISO-8859-1 (or what-ever). So if I create a backing file with some non-ASCII umlauts, the conversion will break, as =DF =3D ß =3D \uc39f =3D ISO-8859-1(0xdf) AFAIK using nl_langinfo(CODESET) would return the codeset previously set by setlocale(LC_ALL, ""), which any main program would need to do. Am I missing something? Sincerely Philipp