Page 1 of 1

[Implemented] Unicode support

Posted: Fri Oct 15, 2004 11:15 am
by Justin
Some kind of unicode support, most MS COM objects work with unicode strings, maybe something like in C+, puting L before the string is passed as unicode,

func(L"TEXT")

and maybe an unicode type .ws to do

st.ws = L"a" + L"B"

and even a WSpace(), to translate unicode results to string

text$ = WSpace(100)

func(@text$) , text$ is filled with the unicode result of func() but translated to ansi

Posted: Fri Oct 15, 2004 4:05 pm
by aXend
You could download COMLIB at http://home.planet.nl/~aXend/purebasic/COMLIB_demo.zip.

COMLIB is a small library that contains 4 procedures:
- CreateObject(ProgID.s) - creates an object from a ProgID, just like VB does
- ReleaseObject(Object.l) - release the object
- Uni2Ansi(Unicode.l) - converts a Unicode string to Ansi
- Ansi2Uni(Ansistr.s) - converts an Ansi string to Unicode

You can find an example at viewtopic.php?t=11018

Posted: Fri Oct 15, 2004 4:49 pm
by Justin
Thanks, i know that i can use functions but native support would save a lot of typing.

Btw, does the lib use its own string buffer or the PB buffer?

Posted: Fri Oct 15, 2004 5:30 pm
by aXend
The strings are allocated by the lib, but you should free memory after use. BTW I think this is "native" PB support and COM wants pointers to Unicode instead of the Unicode strings.

Posted: Fri Oct 15, 2004 11:04 pm
by blueznl
you can't use unicode properly due to pb's string type (zero terminated)

Posted: Fri Oct 15, 2004 11:25 pm
by Justin
yes, PB is built around LPSTR, no direct unicode support. i think at least a WSpace() should be easy to implement and very handy.

Posted: Mon Jan 31, 2005 11:15 pm
by zikitrake
some advance in this aspect?