PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: michaelgreer on May 05, 2022, 05:25:42 PM

Title: UCS-2
Post by: michaelgreer on May 05, 2022, 05:25:42 PM
I am having trouble using the SalesForce API and it appears it might be because those endpoints require UCS-2 encoding.  Can anyone verify this, and more importantly does anyone have a function or routine that creates that encoding.

Thanks!
Michael
Title: Re: UCS-2
Post by: Mike King on May 06, 2022, 08:11:04 AM
UCS-2 appears to be similar to 16 bit Unicode which you can generate using the PxPlus CVS function.

It is however odd that any web based system would require UCS-2 data, normally web processes will use UTF-8 thereby keeping all data 8 bits and provides supports for a wider of characters.
Title: Re: UCS-2
Post by: michaelgreer on May 06, 2022, 09:25:53 AM
Thanks Mike. It is not clear to me using the cvs function how I specify 16 bit UTF-8.
Title: Re: UCS-2
Post by: Mike King on May 06, 2022, 02:17:10 PM
To the best of my knowledge there is no such thing as 16 bit UTF-8.  UTF-8 data is always a string of 8-bit values.

If you want UCS-2 you may be able to do:

   X$=CVS("This is a test","ASCII:UNICODE")

This will provide you a string of 16 bits characters