当前位置: 代码迷 >> Weblogic >> corba 传值包含中文有关问题
  详细解决方案

corba 传值包含中文有关问题

热度:6075   发布时间:2013-02-26 00:00:00.0
corba 传值包含中文问题
大家好,现在在做corba方面的项目碰到了一个问题困扰了两天,贴出来希望得到大家帮助。corba组建是visibroker corba ,我想利用它本身的智能代理(osagent)和通用的命名服务两种方式来传值。我的IDL如下:
module corbaQuery
{
interface CustomerServer
{
  short getCustomerInfo( in string number,out SCustomerInfo sCustomerInfo) ; 
};
struct SCustomerInfo{
string number;
string customerName;
string customerBrand;
string inNetTime;
string currentStatus;
};
};
逻辑很简单,就是客户端通过getCustomerInfo根据number去查找用户信息,存放在sCustomerInfo中返回给客户端,在sCustomerInfo里面中可能含有中文。中文传值会出现问题,在命名服务传值方式中我加入
props.setProperty("com.sun.CORBA.codeset.charsets","0x05010001, 0x00010109"); // UTF-8, UTF-16
props.setProperty("com.sun.CORBA.codeset.wcharsets","0x00010109, 0x05010001");
传值成功,但是在osagent里面传值失败,英文没有问题。找了很多资料都没有解决,望各位大侠赐教

------解决方案--------------------------------------------------------
用wstring,wstring用来处理中文