all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eugen Anghel <eugen@syntactic.org>
Cc: emacs-devel@gnu.org
Subject: Re: Lisp_String to LPWSTR
Date: Sat, 03 Oct 2009 10:35:29 +0200	[thread overview]
Message-ID: <83eipkq3hq.fsf@gnu.org> (raw)
In-Reply-To: <ffeec6560910021459n30b8f848t44c4d6ff3aecf09c@mail.gmail.com>

> From: Eugen Anghel <eugen@syntactic.org>
> 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




  reply	other threads:[~2009-10-03  8:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-02 21:59 Lisp_String to LPWSTR Eugen Anghel
2009-10-03  8:35 ` Eli Zaretskii [this message]
2009-10-03 10:50   ` Eugen Anghel
2009-10-03 11:23     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83eipkq3hq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=eugen@syntactic.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.