From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Lisp_String to LPWSTR Date: Sat, 03 Oct 2009 10:35:29 +0200 Message-ID: <83eipkq3hq.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1254559069 8143 80.91.229.12 (3 Oct 2009 08:37:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Oct 2009 08:37:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eugen Anghel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 03 10:37:42 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mu07Z-0006QN-Sn for ged-emacs-devel@m.gmane.org; Sat, 03 Oct 2009 10:37:42 +0200 Original-Received: from localhost ([127.0.0.1]:35840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mu07Z-0007ST-Em for ged-emacs-devel@m.gmane.org; Sat, 03 Oct 2009 04:37:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mu07T-0007RQ-88 for emacs-devel@gnu.org; Sat, 03 Oct 2009 04:37:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mu07S-0007Pf-6K for emacs-devel@gnu.org; Sat, 03 Oct 2009 04:37:34 -0400 Original-Received: from [199.232.76.173] (port=40996 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mu07S-0007PR-0r for emacs-devel@gnu.org; Sat, 03 Oct 2009 04:37:34 -0400 Original-Received: from mtaout4.012.net.il ([84.95.2.10]:60342 helo=mtaout3.012.net.il) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mu07R-0005Fc-Hb for emacs-devel@gnu.org; Sat, 03 Oct 2009 04:37:33 -0400 Original-Received: from conversion-daemon.i_mtaout3.012.net.il by i_mtaout3.012.net.il (HyperSendmail v2004.12) id <0KQX00E00JUMWC00@i_mtaout3.012.net.il> for emacs-devel@gnu.org; Sat, 03 Oct 2009 10:37:32 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.229.44.55]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KQX00FKIJYJU680@i_mtaout3.012.net.il>; Sat, 03 Oct 2009 10:37:32 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115877 Archived-At: > From: Eugen Anghel > Date: Sat, 3 Oct 2009 00:59:39 +0300 > > What would be the best way to convert from a Lisp_String* to an UTF-16 > encoded string? > > I've tried something like > code_convert_string_norecord(mystring, Qutf_16, 0) > but that doesn't seem to do what I want. > > I'm trying to work on this (from etc/TODO): > ** Switch the Windows port to using Unicode keyboard input (maybe). > and I need to convert strings before passing them to W-variant winapi functions. Like this (untested): code_convert_string_norecord (SDATA (mystring), Qutf_16, 1); Note the two differences: . To get a C string from a Lisp string, use SDATA (btw, why do you manipulate Lisp strings here?) . Converting a Lisp string into UTF-16 (or any other encoding) is an _encode_ operation, so the last argument to code_convert_string_norecord should be non-zero