From patchwork Tue Apr 12 23:49:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 702361 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3CNnksh006231 for ; Tue, 12 Apr 2011 23:49:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757389Ab1DLXto (ORCPT ); Tue, 12 Apr 2011 19:49:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7679 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757163Ab1DLXto (ORCPT ); Tue, 12 Apr 2011 19:49:44 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3CNnf5Y020910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 19:49:41 -0400 Received: from [10.11.8.34] (vpn-8-34.rdu.redhat.com [10.11.8.34]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3CNndHM024767; Tue, 12 Apr 2011 19:49:40 -0400 Message-ID: <4DA4E513.4090301@redhat.com> Date: Tue, 12 Apr 2011 20:49:39 -0300 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Red Hat/3.1.7-3.el6_0 Thunderbird/3.1.7 MIME-Version: 1.0 To: Linux Media Mailing List CC: wk Subject: [PATCH dvb-apps] Allow LANG/LC_TYPE with @ symbol X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Apr 2011 23:49:47 +0000 (UTC) According to IEEE Std 1003.1[1], the common way to specify LANG/LC_TYPE is: language[_territory][.codeset] However, a variant may also be used, like: [language[_territory][.codeset][@modifier]] Change the logic to allow getting the charset also with the extended syntax. [1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Thanks to Winfield for pointing it to me. Signed-off-by: Mauro Carvalho Chehab --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/util/scan/scan.c b/util/scan/scan.c --- a/util/scan/scan.c +++ b/util/scan/scan.c @@ -2565,12 +2565,13 @@ int main (int argc, char **argv) if ((charset = getenv("LC_ALL")) || (charset = getenv("LC_CTYPE")) || (charset = getenv ("LANG"))) { - while (*charset != '.' && *charset) - charset++; - if (*charset == '.') - charset++; - if (*charset) - output_charset = charset; + char *p = strchr(charset, '.'); + if (p) { + p++; + p = strtok(p, "@"); + } + if (p) + output_charset = p; else output_charset = nl_langinfo(CODESET); } else