Solved Unicode character in a maxon::String... how?


a simple question this time... I hope.

I need a maxon::String that looks like this:

© 2021 by some awesome developer

How can I get that copyright symbol in there?

This can't be it:

maxon::Utf32Char copyrightChar = 0x000000A9;
maxon::String copyright;
copyright.SetUtf32(&copyrightChar) iferr_ignore();
maxon::String theActualString = copyright + " 2021 by some awesome developer"_s;

It compiles, but using the resulting maxon::String in a GeDialogs static text element crashes when opening the dialog.

There probably I something about this in the SDK docs, but I couldn't find it.

Thanks in advance for help!

Only asking personal code questions here.

Posting here always helps. Found nothing, until I made the post.

Of course, it's simple:

maxon::String copyright = "\u00A9 2021 by some awesome developer"_s;

Only asking personal code questions here.


thanks a lot for posting the answer.

the problem in your first code is that SetUtf32 is that you didn't define your number of character. In the documentation, the count parameter is defined like so:

Number of valid characters in the buffer. A count of -1 calculates the string length automatically, terminating when \0 is found

3 solutions :

// define the right character number
copyright.SetUtf32(&copyrightChar, 1) iferr_return;
// define an array of Utf32Char and initialise it
maxon::Utf32Char copyrightP[2]{ 0x000000A9 , '\0' };
// Create a buffer in memory
maxon::Utf32Char* copyrightP = NewMemClear(Utf32Char, 2) iferr_return;
	finally {
	copyrightP[0] = 0x000000A9;
	copyrightP[1] = '\0';


MAXON SDK Specialist

MAXON Registered Developer