[Win32utils-devel] Fwd: FFI::MemoryPointer.read_wide_string?

Daniel Berger djberg96 at gmail.com
Mon Nov 11 15:46:41 UTC 2013


I take it that method does not currently exist (I didn't see it in the
source).

What about modifying the existing Pointer#read_string method so that it
accepts an encoding as an optional second argument?

I'm not sure how to implement that, though. It appears that
Pointer#read_string is calling get_string, which is defined in
AbstractMemory.c (in the FFI source). Is it a simple matter of using
wmemchr instead of memchr? Or is it more complex than that?

Or maybe this is better implemented as its own method. I defer to you. :)

Regards,

Dan




On Mon, Nov 11, 2013 at 8:14 AM, Heesob Park <phasis at gmail.com> wrote:

> Hi,
>
> 2013/11/12 Daniel Berger <djberg96 at gmail.com>:
> > Resend due to mailing list issue.
> >
> > ---------- Forwarded message ----------
> > From: Daniel Berger <djberg96 at gmail.com>
> > Date: Thu, Nov 7, 2013 at 12:44 AM
> > Subject: FFI::MemoryPointer.read_wide_string?
> > To: Development and ideas for win32utils projects
> > <win32utils-devel at rubyforge.org>
> >
> >
> > Hi all,
> >
> > Currently the FFI::MemoryPointer#read_string reads up until the first
> null
> > byte. But with wide strings I need to read up until the first two
> > consecutive null bytes.
> >
> > Would it make sense and be useful to add a read_wide_string method that
> did
> > that?
> >
> I think read_string_with_enc(string,encoding) is more useful.
>
> Regards,
> Park Heesob
> _______________________________________________
> win32utils-devel mailing list
> win32utils-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/win32utils-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20131111/79d8650b/attachment.html>


More information about the win32utils-devel mailing list