How to correctly use UTF8 with JUCE strings


#1

Is this the correct way to instantiate a UTF8 character, or am I simply lucky this seems to work for me?

[color=#0000BF] String foo = String::fromUTF8( “blah \u2022 blah” ); // e.g., bullet[/color]

I see other things in C++11, such as U"…", u"…", and u8"…" but while I can guess what u8 does, I still haven’t found a decent description of the difference between U"…" and u"…"


#2

The easiest thing to do is use the Introjucer’s “UTF-8 String Literal Converter” from the tools menu.
E.g. “hello • world” becomes: