methodinfo invoke data is getting lost

  • Thread starter Thread starter Parvathy_priya
  • Start date Start date
P

Parvathy_priya

Guest
Hi,

I am calling dontNET class from C++ program using methodinfo invoke method.Parameter for the invoke method i have given as string.the value of the string is in UTF8 codepage.i am printing the parameter via dotnet call it is printing ASCII charter.Data is getting lost.



c++ program:

char *param="Şəçüöğ"

String *args[] = new String*[1];
args[0]= new String(param);
printf("from try %s",args[0]);
String *str=static_cast<String*>(mi->Invoke(o,args));

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T24Unicode
{
public class UnicodeTest
{
public string GetData(string text1)
{

byte[] utf = System.Text.Encoding.UTF8.GetBytes(text1);
string s2= System.Text.Encoding.UTF8.GetString(utf);
Console.WriteLine("The value returned from .cs when writing the parameter using Console.WriteLine : "+s2);
return text1;
}
}
}

output:

The value returned from .cs when writing the parameter using Console.WriteLine : Şəçüöğ

can someone please help on this?

Continue reading...
 
Back
Top