Annatooli Posted July 29, 2020 Report Share Posted July 29, 2020 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 Quote Link to comment Share on other sites More sharing options...
Annatooli Posted July 29, 2020 Author Report Share Posted July 29, 2020 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 } Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted July 29, 2020 MVP 2022 Report Share Posted July 29, 2020 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. Quote Link to comment Share on other sites More sharing options...
Annatooli Posted July 30, 2020 Author Report Share Posted July 30, 2020 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.