Archived

This forum has been archived. Please start a new discussion on GitHub.

MarshalException because of umlauts

Hello everybody,

I'm using a C++ ICE service which sends Notifications via IceStorm to a C#-Client. If the message contains some umlauts (ä, ö, ü) an Ice.MarshalException on Client side raises in the automated generated File from the slice file which contains the notification functions:


[_System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011")]
public static Ice.DispatchStatus notifyEvent___(DataNotifierIcing obj__, IceInternal.Incoming inS__, Ice.Current current__)
{
checkMode__(Ice.OperationMode.Normal, current__.mode);
IceInternal.BasicStream is__ = inS__.startReadParams();
string eventMessage;
bool continueAllowed;
eventMessage = is__.readString();
continueAllowed = is__.readBool();
inS__.endReadParams();
obj__.notifyEvent(eventMessage, continueAllowed, current__);
inS__.writeEmptyParams__();
return Ice.DispatchStatus.DispatchOK;
}


(in the line eventMessage = is__.readString();)
It's an english 64bit windows system (Ice 3.5).

Any ideas what I could do to fix the problem?

Thanks in advance!
Cheers,
Kiola

Comments

  • benoit
    benoit Rennes, France
    Hi Johanna,

    Can you copy/paste the exception stack trace? You need to make sure the string your provide to the notifyEvent method in your C++ publisher is a valid UTF-8 string.

    You will therefore need to make the conversion from your native code-set to UTF8 before passing the string to notifyEvent. Another option is to configure a string converter with the Ice communicator and Ice will take care of converting the string from the native code-set to the UTF8 before marshaling it.

    For more information on this see: https://doc.zeroc.com/pages/viewpage.action?pageId=5048316

    Cheers,
    Benoit.
  • Thanks!

    I tried the StringConverterI example in the demos folder yesterday (using the Ice natveToUTF8 method in every notifyEvent-call) and it seems to work now.

    I'm working with Visual Studio. The Character Set was set to "Multi-Byte Character Set". First I thought that is the problem. But compiling with "Unicode Character Set" didn't work, too.