Missing CharPointer_UTF8 in OggVorbisAudioFormat


Pretty much by accident I noticed at least the following code in juce_OggVorbisAudioFormat.cpp should probably be like the following :

void addMetadataItem (OggVorbisNamespace::vorbis_comment* comment, const char* name, const char* metadataName)
    if (const char* value = vorbis_comment_query (comment, name, 0))
        metadataValues.set (CharPointer_UTF8(metadataName), CharPointer_UTF8(value));


How do you figure? It should be implicitly converted to a String, seeing that String has a constructor for const char*.


Asserts in debug builds if the metadata has UTF8 characters.


From my research, there is no standardised encoding for Vorbis comments (short sighted standards strike again!). So it would seem possible to have different codepages as well, not just UTF8 encoding.

This reminds me of the codepage shenanigans that needed to be added, specifically CharacterFunctions::getUnicodeCharFromWindows1252Codepage. It’s probably better to use String::createStringFromData instead as it does checks for that sort of thing.