Hi, are there any non-unicode text/string data types for Basic? I think I have a problem with sending a string over DDE. The receiving app does not support unicode and cuts off the string at one character. I was told this is because the app doesnt support unicode characters. How do I define that I don't want to use the unicode data types?
Is there a way to create new data types like in C++?
Thanks,
Brainwav
[Solved] Non-Unicode data type for Basic
[Solved] Non-Unicode data type for Basic
Last edited by brainwav on Wed Feb 13, 2008 4:17 pm, edited 1 time in total.
Re: non-Unicode data type for Basic
Ok, I figured things out. I wrote a function that converts a unicode string to a non-unicode format using unnicode strings. It worked for what I was doing. Basically unicode strings have 2 bytes per character, so I skwiched the the bytes together. Heres the code:
Brainwav.
Code: Select all
Function ConvertUnicode( start as String ) as String
Dim finish as String
length = len( start )
' print "Unicode Length = " & length
finish = ""
for i = 1 to length step 2
a = asc( mid$( start, i, 1 ) )
if ( ( i+1 ) <= length ) then
b = asc( mid$( start, i+1, 1 ) )
c = a + ( b * 256 )
finish = finish & chr( c )
else
finish = finish & chr( a )
end if
next i
ConvertUnicode = finish
end Function