How to convert a ruby string into WChar string in ruby?

Discussion in 'Ruby' started by Wu Nan, Dec 25, 2007.

  1. Wu Nan

    Wu Nan Guest

    [Note: parts of this message were removed to make it a legal post.]

    Hi,
    I want to use the Win32API, however the API I use need the WChar string as a
    parameter.
    So how can I convert a ruby string into WChar String?

    Thanks very much.
    Wu Nan, Dec 25, 2007
    #1
    1. Advertising

  2. Wu Nan

    Wu Nan Guest

    [Note: parts of this message were removed to make it a legal post.]

    Hi,
    Thank you for your hint, but I have searched it all around the world with
    Google and also searched the archives.
    Maybe I used a wrong Key words, I found nothing I want.

    Could you give me something more information?

    Thanks very much.

    Nan


    2007/12/26, Konrad Meyer <>:
    >
    > Quoth Wu Nan:
    > > Hi,
    > > I want to use the Win32API, however the API I use need the WChar string

    > as a
    > > parameter.
    > > So how can I convert a ruby string into WChar String?
    > >
    > > Thanks very much.

    >
    > There have been previous posts about this. If you search the archives I'm
    > sure
    > you'll find it.
    >
    > --
    > Konrad Meyer <> http://konrad.sobertillnoon.com/
    >
    >
    Wu Nan, Dec 26, 2007
    #2
    1. Advertising

  3. Wu Nan

    Wu Nan Guest

    [Note: parts of this message were removed to make it a legal post.]

    Thank you,
    In fact I have found this post before.
    It indicate the difference between Ruby string and UTF16 string.
    I have tried to find a ruby way (Beatifully and simply), it seems I should
    do it manually now. :(

    Any way, thank you very much.

    Nan


    2007/12/26, Konrad Meyer <>:
    >
    > Quoth Wu Nan:
    > > Hi,
    > > Thank you for your hint, but I have searched it all around the world

    > with
    > > Google and also searched the archives.
    > > Maybe I used a wrong Key words, I found nothing I want.
    > >
    > > Could you give me something more information?
    > >
    > > Thanks very much.
    > >
    > > Nan
    > >
    > >
    > > 2007/12/26, Konrad Meyer <>:
    > > >
    > > > Quoth Wu Nan:
    > > > > Hi,
    > > > > I want to use the Win32API, however the API I use need the WChar

    > string
    > > > as a
    > > > > parameter.
    > > > > So how can I convert a ruby string into WChar String?
    > > > >
    > > > > Thanks very much.
    > > >
    > > > There have been previous posts about this. If you search the archives

    > I'm
    > > > sure
    > > > you'll find it.
    > > >
    > > > --
    > > > Konrad Meyer <> http://konrad.sobertillnoon.com/

    >
    > Maybe this will help you (maybe not):
    > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/195059
    >
    > I've been googling for "site:blade.nagaokaut.ac.jp ruby-talk archives
    > windows
    > wide character", you can try digging through that too.
    >
    > Regards,
    > --
    > Konrad Meyer <> http://konrad.sobertillnoon.com/
    >
    >
    Wu Nan, Dec 26, 2007
    #3
  4. On Dec 25, 4:23=A0am, "Wu Nan" <> wrote:
    > Hi,
    > I want to use the Win32API, however the API I use need the WChar string as=

    a
    > parameter.
    > So how can I convert a ruby string into WChar String?
    >
    > Thanks very much.


    require 'windows/unicode'
    include Windows::Unicode

    str =3D multi_to_wide(str)

    Regards,

    Dan
    Daniel Berger, Dec 26, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flzw

    std::string -> WCHAR*

    Flzw, Aug 29, 2004, in forum: C++
    Replies:
    14
    Views:
    46,431
    Tilman Kuepper
    Mar 11, 2005
  2. Lars Nielsen

    wchar vs std::string

    Lars Nielsen, Jun 9, 2005, in forum: C++
    Replies:
    3
    Views:
    11,736
    Lars Nielsen
    Jun 9, 2005
  3. sweety

    How to convert char* to WCHAR* in C

    sweety, Feb 22, 2006, in forum: C Programming
    Replies:
    4
    Views:
    13,300
    Jordan Abel
    Feb 22, 2006
  4. Manjunath.M

    How to Copy char* string to WCHAR[] string

    Manjunath.M, Feb 22, 2007, in forum: C Programming
    Replies:
    18
    Views:
    9,687
    santosh
    Feb 22, 2007
  5. Vinu
    Replies:
    1
    Views:
    1,426
    msalters
    Aug 4, 2005
Loading...

Share This Page