From 65921445842c9ec5d17010beedd890c68ab1928a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 24 Jun 2022 19:12:38 -0700 Subject: [PATCH] [Vorbis / Opus] Do not assume text encoding Stream metadata encoding may not be UTF-8, even though the Vorbis Comment specification clearly calls for this. Signed-off-by: Christopher Snowhill --- Plugins/Opus/Opus/OpusDecoder.m | 2 +- Plugins/Vorbis/VorbisDecoder.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Opus/Opus/OpusDecoder.m b/Plugins/Opus/Opus/OpusDecoder.m index 6aa435bde..fc09fbbd7 100644 --- a/Plugins/Opus/Opus/OpusDecoder.m +++ b/Plugins/Opus/Opus/OpusDecoder.m @@ -146,7 +146,7 @@ opus_int64 sourceTell(void *_stream) { for(int i = 0; i < tagCount; ++i) { const char *value = opus_tags_query(tags, [tag UTF8String], i); - [tagStrings addObject:[NSString stringWithUTF8String:value]]; + [tagStrings addObject:guess_encoding_of_string(value)]; } return [tagStrings componentsJoinedByString:@", "]; diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index c40796fcd..30302c795 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -126,7 +126,7 @@ long sourceTell(void *datasource) { for(int i = 0; i < tagCount; ++i) { const char *value = vorbis_comment_query(tags, [tag UTF8String], i); - [tagStrings addObject:[NSString stringWithUTF8String:value]]; + [tagStrings addObject:guess_encoding_of_string(value)]; } return [tagStrings componentsJoinedByString:@", "];