From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19910: 24.4; Japanese font names are decoded incorrectly in Cygwin's emacs-w32 in LANG=ja_JP.UTF-8 Date: Fri, 27 Feb 2015 18:03:46 +0200 Message-ID: <83y4nj49zx.fsf@gnu.org> References: <83h9ugltg1.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1425053067 3584 80.91.229.3 (27 Feb 2015 16:04:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Feb 2015 16:04:27 +0000 (UTC) Cc: 19910@debbugs.gnu.org To: Fujii Hironori Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 27 17:04:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YRNOg-0001ar-Vs for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Feb 2015 17:04:15 +0100 Original-Received: from localhost ([::1]:37212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNOg-00016m-Ef for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Feb 2015 11:04:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNOc-00016h-SB for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:04:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRNOV-0005Fa-87 for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:04:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRNOV-0005Dz-53 for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:04:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YRNOU-00067W-Ht for bug-gnu-emacs@gnu.org; Fri, 27 Feb 2015 11:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Feb 2015 16:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19910 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19910-submit@debbugs.gnu.org id=B19910.142505301823492 (code B ref 19910); Fri, 27 Feb 2015 16:04:02 +0000 Original-Received: (at 19910) by debbugs.gnu.org; 27 Feb 2015 16:03:38 +0000 Original-Received: from localhost ([127.0.0.1]:60118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YRNO5-00066q-SB for submit@debbugs.gnu.org; Fri, 27 Feb 2015 11:03:38 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:51065) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YRNO3-00066c-LV for 19910@debbugs.gnu.org; Fri, 27 Feb 2015 11:03:37 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NKF00D00TWIGO00@a-mtaout21.012.net.il> for 19910@debbugs.gnu.org; Fri, 27 Feb 2015 18:03:28 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NKF00DO3TXSDN80@a-mtaout21.012.net.il>; Fri, 27 Feb 2015 18:03:28 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99871 Archived-At: > Date: Sat, 28 Feb 2015 00:22:00 +0900 > From: Fujii Hironori > Cc: 19910@debbugs.gnu.org > > On Fri, Feb 20, 2015 at 8:21 PM, Eli Zaretskii wrote: > > The problem is in w32font.c: it should call the "wide" (a.k.a. > > "Unicode") APIs, and then decode strings using utf-16le, like we do in > > w32fns.c with encoding strings we pass to w32 GUI APIs. > > Unicode API patch is attached. Could you review it? > Should I use GetProcAddress for Windows 9x? Thanks. However, this goes too far: there's no need to replace all the functions with "wide" versions, only those functions that return font name strings from the system. For example, I don't think CreateFontIndirect needs to be switched to Unicode, does it? And CRT functions like _wcslwr and swprintf that work on wchar_t arguments aren't supported on Windows 9X, AFAIK, so we cannot call them. (One reason for using the minimum number of "wide" APIs is that we don't have good ways of testing the development code on Windows 9X.) And yes, for Windows 9X you will need to call these functions through function pointers, after assigning them with GetProcAddress, as w32font.c does elsewhere. I would actually suggest to have a Cygwin-only branches of the code, where you can freely call the "wide" APIs without bothering about Windows 9X, since that's what the Cygwin-w32 build does elsewhere, and since this is a Cygwin-specific problem due to the difference between file-name encoding and the locale emulated by Cygwin. There are a bunch of macros like GUI_STR and GUI_ENCODE_FILE near the end of w32term.h that can be used to minimize #ifdef's to the absolute minimum.