Transferring extended ascii characters with unknown encoding to a Twisted XMLRPC from C#

Basically I want to pass a string which contains Spanish text that could be in one of several encodings (Latin-1, CP-1252, or UTF-8 to name a few). Once it gets to the XMLRPC I can detect the encoding, but I won't know it before then. C#, by default seems to be killing any characters outside of ASCII. I've gotten around the problem by base64-encoding the string but I'd really love to NOT do that.

I'm using CookComputing.XmlRpc... Here's a code snippet of my interface:

public interface ISpanishAnalyzer
{
    [XmlRpcMethod("analyzeSpanishString")]
    int analyzeSpanishString(string text);
}

Any help would be appreciated. Thanks!


ANSWERS:


I don't think there is really a better way then base64 encoding. As long as you do not know the encoding, you have no other possibility as to handle it as a byte array. The only change I would suggest is to make this explicit by using a byte[] parameter instead of a string and letting the XmlRpc library to take care of the base64 encoding (assuming that it supports this).



 MORE:


 ? Transferring extended ascii characters with unknown encoding to a Twisted XMLRPC from C#
 ? how to: Twisted privmsg to accept non-ascii strings
 ? How to send XML-RPC request from XML-RPC callback in twisted
 ? Allowing any ASCII character transmitted in string with xmlrpc
 ? Rails 4: incompatible character encodings: UTF-8 and ASCII-8BIT
 ? twisted xmlrpc and numpy float 64 exception
 ? GetPrivateProfileString Oddity
 ? GetPrivateProfileString Oddity
 ? GetPrivateProfileString Oddity
 ? Getprivateprofilestring Bug