Improved wide char handling in the C# and CLI.

References #320.