Jump to content

Recommended Posts

Posted

Is there way to convert STRING-ASCII to STRING-UTF16. 

I have data table with UTF-16 column for messages, but in one case I want to add number there, but number is in ASCII. Maybe someone knows some existing method for this kind of conversion ?

I can probably create this function, but is UniLogic internally "Little endian" or "Big endian" ?

Anatoly

 

Posted

It was actually easier than I imagined:

static void String_AToU(volatile char* FI, int FILen, volatile short* FO, int FOLen)
{
	// User code starts below this comment
		for (int i=0 ; i < FILen ; i++ ){
			FO[i] = (short) FI[i];
		}
		FOLen = FILen;	

	// User code ends above this comment
}

 

  • MVP 2023
Posted

When first looked at this post I couldn't spell "UTF-16".  I knew it was a valid string type but never thought more about it.  This post woke up the squirrel and I leaned on my friend Dr. Google to at least learn what this data type is.  So now I know more than I did this morning about how many different characters can be referenced with this format (1,112,064).

I sit at your feet, Anatoly.  What are you doing that you need this?

Joe T.  

Posted

On screen I have long data table where is written states like open, closed, waiting etc.  But most of my messages are in Russian, so only way  for this is UTF-16. 

In one  instance  I need to show timer value there and this is where conversion is needed.

Anatoly

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.