[Implemented] Unicode support

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

[Implemented] Unicode support

Post 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
aXend
Enthusiast
Enthusiast
Posts: 103
Joined: Tue Oct 07, 2003 1:21 pm
Location: Netherlands

Post 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
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post 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?
aXend
Enthusiast
Enthusiast
Posts: 103
Joined: Tue Oct 07, 2003 1:21 pm
Location: Netherlands

Post 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.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

you can't use unicode properly due to pb's string type (zero terminated)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post 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.
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

some advance in this aspect?
PB 6.21 beta, PureVision User
Post Reply