The problem is when you create the session you are specifying a Unicode map.
The VM is a Unicode leader character (utf8 and utf16) which mangles the following string - if you look at the byte array underneath the dynarray you will see that it has added a \0 for each one, so presumably that works for the first value (scans to the first 253) and then screws up the following as the next byte is a zero.
Always problems with mapping between UniVerse marker characters and Unicode.
Change to:
var ses = U2.Data.Client.UO.UniSession.NullSession(null);
and it will show the correct result.
------------------------------
Brian Leach
Director
Brian Leach Consulting
Chipping Norton GB
------------------------------
Original Message:
Sent: 10-14-2024 05:40
From: Koon MIng Fong
Subject: .NET & UniDynArray
Hi All,
I am exploring using UniDynArray.
My Sample Code
String xVM = Convert.ToChar(253).ToString(); string inS = "H1" + xVM + "H2" + xVM + "H3"; U2.Data.Client.UO.UniSession ses = U2.Data.Client.UO.UniSession.NullSession(null,Encoding.Unicode); var dynArray = ses.CreateUniDynArray(inS); var s = dynArray.ToString(); MessageBox.Show(dynArray.Extract(1, 1).StringValue); MessageBox.Show(dynArray.Extract(1, 2).StringValue);
Issue:
My first MessageBox is correct, but the 2nd one is showing me some rubbish..
------------------------------
Koon MIng Fong
Mr
P & O Global Technologies SDN. BHD.
KUALA LUMPUR MY
------------------------------