Handle extended ascii and double byte in GUI.

This commit is contained in:
Jim Norman 2005-11-01 16:21:40 +00:00
parent 02fb4c49c6
commit 54fb8faee1

View File

@ -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);
{
//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++)