Skip to content

Commit a6871b3

Browse files
authored
Allow to disable ASCII check in IDv3 parser (#2056)
1 parent 2d0fb71 commit a6871b3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
#include <ctype.h>
1212
#include "AbstractMetaData.h"
1313

14+
/**
15+
* An optional flag to disable the Non-ASCII character check on IDv3 metadata checks.
16+
* Set this to `true` if having issues parsing Unicode metatags in MP3 files.
17+
* Feature-flagged to prevent breaking changes to existing users. -akasaka/2025
18+
**/
19+
#ifndef AUDIOTOOLS_ID3_TAG_ALLOW_NONASCII
20+
#define AUDIOTOOLS_ID3_TAG_ALLOW_NONASCII false
21+
#endif
1422

1523
/**
1624
* @defgroup metadata-id3 ID3
@@ -454,7 +462,7 @@ class MetaDataID3V2 : public MetaDataID3Base {
454462
memset(result.data(), 0, result.size());
455463
strncpy((char*)result.data(), (char*) data+tag_pos+ID3FrameSize, l);
456464
int checkLen = min(l, 10);
457-
if (isAscii(checkLen)){
465+
if (isAscii(checkLen) || AUDIOTOOLS_ID3_TAG_ALLOW_NONASCII){
458466
processnotifyAudioChange();
459467
} else {
460468
LOGW("TAG %s ignored", tag);
@@ -607,4 +615,4 @@ class MetaDataID3 : public AbstractMetaData {
607615
int filter = SELECT_ID3;
608616
};
609617

610-
} // namespace
618+
} // namespace

0 commit comments

Comments
 (0)