Using unicode music symbols on mac os x

I’ve been trying to use some of the basic unicode characters for musical symbols such as the g clef character, but I’ve been having no luck getting these characters to render correctly.

Based on what I read on this code page description for g clef,, I would have thought that the following line would have produced the correct symbol:

String gClefSymbol(CharPointer_UTF32(L"\U0001d11e"), 1);

But instead it rendered an h with a breve below it (

I’ve tried to produce the correct String representation of this character in half a dozen different ways, but none of them have worked. Does anyone have any idea how to get these characters to render correctly?

The L"" syntax creates utf16, not utf32! You’d need to encode it as utf-8 to be portable.

The latest introjucer version (in the modules branch) has a handy utf-8 code formatting tool that lets you paste some unicode text into a textbox, and then shows you the C++ utf-8 equivalent.