Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

"Cannot marshal: Encountered unmappable character." when creating TdmsChannel.

Solved!
Go to solution

It seems that the TdmsChannel unit string, description (and most likely name) properties cannot handle Unicode characters, even though the properties take a .NET System.String parameter. When adding e.g. a description "SPO₂" (SPO2, with a subscript 2) I get the following error:

 

Cannot marshal: Encountered unmappable character.

 

This is very inconvenient, as I now have to map from Unicode to something that the TdmsChannel can handle. Whatever that is ... ? (I'm about to start experimenting.)

0 Kudos
Message 1 of 7
(8,801 Views)

The same problem applies to TdmsProperty (string) values. *sigh*

0 Kudos
Message 2 of 7
(8,798 Views)
Solution
Accepted by topic author MiF

Hello MiF -

 

Sorry to take so long to get back to you.  Unfortunately, I don't have very good news for you either.  The TDMS .NET library does not support unicode characters, because the underlying API the .NET layer uses does not support unicode.  This should be documented, but for the life of me, I haven't been able to find that documentation.  I will file a bug report to improve the documentation of this.

 

Sorry for any inconvenience,

 

NickB

National Instruments

0 Kudos
Message 3 of 7
(8,772 Views)

Nick,

 

1) Can you comment on where exactly the problem is located? TDMS stores all strings as UTF8, and the components used for TDMS access throughout NI software support that accordingly. We might be out of luck in the .NET layer, but maybe there's a chance we can work around this by hooking something into one of the underlying APIs.

 

 

2) This should not be documented, this should be fixed. Could you file a CAR for that rather than for a documentation change?

 

Thanks,

Herbert

Message 4 of 7
(8,768 Views)

Update: MStudio calls an interface that was designed to be used within an ANSI C environment. This interface exposes strings as ANSI strings and uses conversion functions further down the chain. Supporting Unicode throughout this part of our component stack is not a small change, so we might end up just documenting this as a known constraint for now.

 

Thanks,

Herbert

0 Kudos
Message 5 of 7
(8,735 Views)

Thank you Nick/Herbert for the replies. For now I'm stripping everything that is not plain ASCII. It is not pretty, but at least the app doesn't crash.

 

Mikael

0 Kudos
Message 6 of 7
(8,714 Views)

Nick,

 

I found this thread regarding the same error I have just encountered and wished to see if there is any new information.

 

So I am running into the same problem with NetworkVariableBufferedWriters (VS 2008).  What I am tring to do is serialize an xml object (short document or just a node) and pass it throught the Variable Server to another attached process which presumable deserializes the xml back into an object and acts on the object.  Do you have any suggestions on how I might accomplish this task?

 

I do have Measurement Studio 2013 (and Visual Studio 2012), is this an issue within those version as well?

 

Thank you very much

Dave Gleason

0 Kudos
Message 7 of 7
(7,529 Views)