P/Invoke Tutorial: Passing strings (Part 2)

In the previous tutorial we passed a single string to a native C/C++ function by using P/Invoke.

This function was defined like this:

// C++
void print_line(const char* str);
// C#
[DllImport("NativeLib.dll")]
private static extern void print_line(string str);

However, there exists a hidden pitfall here:

What happens when the user passes a non-ASCII character to this function?

Read more →

Unicode, UTF-8, WTF?

Ever wondered what Unicode is and how it relates to UTF-8, UTF-16, and so on? Or did you stumble over “code points” and didn’t know what the difference to characters is?

Then you should try out the shiny new Unicode Explorer.

For some basics, click on the “Basics” link in the Unicode Explorer.

MayaStudios Unicode Explorer