#if JUCE_WINDOWS && ! DOXYGEN
#define JUCE_NATIVE_WCHAR_IS_UTF8 0
#define JUCE_NATIVE_WCHAR_IS_UTF16 1
#define JUCE_NATIVE_WCHAR_IS_UTF32 0
#else
/** This macro will be set to 1 if the compiler's native wchar_t is an 8-bit type. */
#define JUCE_NATIVE_WCHAR_IS_UTF8 0
/** This macro will be set to 1 if the compiler's native wchar_t is a 16-bit type. */
#define JUCE_NATIVE_WCHAR_IS_UTF16 0
/** This macro will be set to 1 if the compiler's native wchar_t is a 32-bit type. */
#define JUCE_NATIVE_WCHAR_IS_UTF32 1
#endif
#if JUCE_NATIVE_WCHAR_IS_UTF32 || DOXYGEN
/** A platform-independent 32-bit unicode character type. */
typedef wchar_t juce_wchar;
#else
typedef uint32 juce_wchar;
#endif
So, it’s not what I’m asking. I’m asking something like this in juce_config.h
#if defined(JUCE_DEBUG) && defined(JUCE_WINDOWS)
#define JUCE_DEBUG_STRING 1 // Enabled this on debug build so the strings are UTF-16 and not UTF-32
#endif
The problem with holding the string as anything other than full unicode is that it prevents random access, so a whole bunch of string manipulation ops need to be rewritten to deal with that. I’ve got a few ideas on how to do it, but haven’t got there yet. Will do soon.
Well if you can’t think of anything, you could always just store them as utf-16 and still allow random access (like the original Windows Utf-16 String) , just for debugging. I mean, yeah in theory it will screw up with high code points but in practice, it will allow debugging. That’s if no better solutions present themselves.
The debugger doesn’t mind if it’s private AFAIK, at least under visual studio 2008.
One “trick” I use (in VS) is to write the expression "myString.text.data,100s"
This displays the 100 first characters of the string as an array . Not optimal but works
I’m in Android-land at the moment but will go back to working on strings soon. I think Cyril’s suggestion is very good though - it’s a one-line change and will work just fine.
I’d rather not change to codebase to do it, but if that what it’s gonna take I’ll have to. Meanwhile I found a way to view the native (UTF32) String in the debugger watch window through the expression (if s is the juce String):
Exactly what do I need to change so that I don’t get a ton of compile errors/warnings (f.i. juce_String.h (131,134) and juce_CharPointer_UTF16.h (160) ) ??
erm… since the changes I checked in last week, the strings are all encoded as UTF8, so the debugger just shows them without any need for any messing about. Sorry, I thought you’d have noticed that change.