[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp_String to LPWSTR

From: Eli Zaretskii
Subject: Re: Lisp_String to LPWSTR
Date: Sat, 03 Oct 2009 10:35:29 +0200

> From: Eugen Anghel <address@hidden>
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]