-----BEGIN PGP SIGNED MESSAGE----- Moin,
On Monday 08 March 2004 21:24, Nick Ing-Simmons wrote: > Randy W. Sims <[EMAIL PROTECTED]> writes: > >On 03/08/04 12:26, Tels wrote: > >> Good news: I asked on the Irrlicht board, and their very helpfull > >> answer was, use some obsucre conversation function: > >> CODE: > >> // TODO: find out length of scalar and alloc memory for myTitle? > >> mbstowcs(mytitle, caption, 512); > > I think the normal way to get the length is to use the related > function mbsrtowcs() twice - once passing NULL as dest to get > character count, the malloc-ing buffer and then calling again > to do the actual conversion. I should have read the manpage better. Of course, just allocating n*4 or so bytes would suffice. OTOH, if I specify 512, and allocate 512, it would never use more than 512. And since my input is ASCII, I know how many bytes I have, so I know how many to allocate. Input utf-8 and other nastitties left aside for now.. > >> device->setWindowCaption(mytitle); > >> > >> This works! :) However, whoever thought up the name of these > >> conversion functions should be shot. Honestly, who can remember these > >> cryptic garbage names like mbscwsomethingfoobar? Glad that I have to > >> write it only once as macro in XS :) > > > >Multi-Byte String TO Wide Character String. I don't think that function > >is portable though, but I could be wrong. > >And it doesn't seem like the > >right conversion function to convert ascii to wide char, but I could be > >wrong about that too - I know almost nothing about wide strings :(. > > It doesn't convert from ASCII as such, but rather the locale specfic > multibyte encoding that is assumed to be the "on disk" representation. > It can be the right thing to use to convert from UTF-8 if one is in a > UTF8-locale. Most european non-UTF-8 locales are not really "multibyte", > but none the less the above works. > > Note that perl strings are usually either in UTF-8 - in which case > above is only correct if you are in a UTF-8 locale - or as "octets" > which are perhaps treated as characters in either iso-8859-1 or > - if you have explicitly asked for it - a locale specific encoding. > (This may not matter in practice - perl's intent is to "just work".) That above all makes my head spin..../me takes some dried frog pills/ Cheers, and thank you for your help! tels - -- Signed on Mon Mar 8 21:30:10 2004 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. "Retsina?" - "Ja, Papa?" - "Warp 3." - "Is gut, Papa." -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. iQEVAwUBQEzYd3cLPEOTuEwVAQG+2wf6AvcKqqoUWUTnuD77htPwEtRpMx1kNOGm i/3PffSh8dvDogdp3UHukVbxPK2y6oAINmRW8FrYccg8PiD6DiorrAaa3YfJn1hf kUGOTzvZNuNfwamts4dFd4h7cCc2Aibs+VT6dCoZVDRZxLEjT7axtFvCK9tiei6V GNZwpd9uffqsYwwB5yfM3use7aJQ94KG7EMz4eqB7lJtNhKOVfAkOapy4kibspo1 ItQnkh4mSQklvFC7J41Yvpbsuu+RYyDXpsZNek9rt18ea4JHWw+doiu7uSir2QkS 0OVaeX6nq21u32ProCwYudgfBbdcabGbrQu+2N/ciCgLVKP7XHSAVA== =oSmH -----END PGP SIGNATURE-----