diff --git a/c_sharp/NSSCSWrapper/NativeCalls.cs b/c_sharp/NSSCSWrapper/NativeCalls.cs index 64f2db38..e720a508 100644 --- a/c_sharp/NSSCSWrapper/NativeCalls.cs +++ b/c_sharp/NSSCSWrapper/NativeCalls.cs @@ -587,12 +587,29 @@ namespace Novell.CASA else { if (iKeyLen > 1) - sKey = Marshal.PtrToStringAnsi(theKey, (int)iKeyLen - 1); + { + //sKey = Marshal.PtrToStringAnsi(theKey, (int)iKeyLen - 1); + // convert from UTF8 + byte[] baKey = new byte[iKeyLen-1]; + Marshal.Copy(theKey, baKey, 0, (int)iKeyLen-1); + sKey = System.Text.Encoding.UTF8.GetString(baKey, 0, baKey.Length); + } + if (iValueLen > 1) - sValue = Marshal.PtrToStringAnsi(theValue, (int)iValueLen -1); - - secret.setKeyValuePair(sKey, sValue); + { + //sValue = Marshal.PtrToStringAnsi(theValue, (int)iValueLen -1); + + // convert from UTF8 + byte[] baValue = new byte[iValueLen-1]; + Marshal.Copy(theValue, baValue, 0, (int)iValueLen-1); + sValue = System.Text.Encoding.UTF8.GetString(baValue, 0, baValue.Length); + } + + if (sKey != null && sValue != null) + secret.setKeyValuePair(sKey, sValue); + + iStart = 0; } @@ -720,7 +737,7 @@ namespace Novell.CASA internal bool KeyInNewList(NameValueCollection nvc, string key) { - Console.WriteLine("Checking for " + key ); + //Console.WriteLine("Checking for " + key ); if (nvc != null) { for (int i = 0; i < nvc.Count; i++)