Dave, this may be an endian issue. The string below is a big endian unicode string, if you're on an intel machine you'll need to either reverse each pair before calling unidecode, or simpler (if you're sure there'll be no non-ascii characters) just 'replace null with empty in myStringData'.

Best,

Mark

On 17 Jan 2008, at 00:57, Dave wrote:

Hi,

I'm reading a string from a file that is stored in Unicode (2-byte) format. I need to convert it to one byte characters in order to write the string to a database which is later sent to the server.

When I execute the following it gives unexpected results

put uniDecode(myStringData,"ANSI") into myStringData

For instance, before executing the above, myStringData contained the following (in Decimal):

84 0 104 0 101 0 32 0 65 0 108 0 103 0 101 0 98 0 114 0 97 0 105 0 115 0 116 0

afterwards it contains:

0 0 0 0 0 0 0 0 0 0 0 0 0 0

I also tried uniDecode(myStringData) (leaving the second parameter empty) which results in the same string being returned as was input, e.g. in this case:

84 0 104 0 101 0 32 0 65 0 108 0 103 0 101 0 98 0 114 0 97 0 105 0 115 0 116 0


My question is, how can I convert a 2 byte string into a 1 byte string?

Thanks a lot
All the Best
Dave

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to