NativeMessageBox choking on non-english characters

If I do this (juce 1.47, OSX 10.6.7):

NativeMessageBox::showMessageBox(AlertWindow::WarningIcon, "Load", "Åäö");

I get an assertion: -[NSTextFieldCell _objectValue:forString:errorDescription:], /SourceCache/AppKit/AppKit-1038.35/AppKit.subproj/NSCell.m:1531
and then the application terminates hard!

Without the english only chars it works fine.

Doesn’t the NativeMessageBox handle Unicode chars ??

Edit: After som debugging it seems that the line:

in OSXMessageBox::getRawResult returns a NULL pointer. Ouch!


Bah! Disregard that post. If I do L"Åäö" it works :oops:

Ok, so my problem is elsewhere… sorry for spending your time…

I was just about to reply and say that in fact the correct string would be:

NativeMessageBox::showMessageBox(AlertWindow::WarningIcon, "Load", CharPointer_UTF8 ("\xc3\x85\xc3\xa4\xc3\xb6"));

Looks like the debugger is misleading you about the location of the assertion.

No, the place is correct. However, the string passed contains some bogus characters that fail the UTF8 to NSString internal conversion. Now I just need to figure out how they got there…

Ok, found it, it was an UTF8 const char* text that was converted to juce::String, not via String::fromUTF8, but the const char* constructor, and since I run english OS I have never gotten the assert in that constructor (CharPointer_ASCII::isValidString)…