From 196acecc04f76bdb26eab53c7494c771ec63b3a1 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 5 Oct 2009 11:15:03 -0700 Subject: [PATCH] id3mux: Write UTF-16 byte order marker correctly. --- gst/id3tag/id3tag.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/id3tag/id3tag.c b/gst/id3tag/id3tag.c index 7af74fc65c..bd481e1f3b 100644 --- a/gst/id3tag/id3tag.c +++ b/gst/id3tag/id3tag.c @@ -363,7 +363,8 @@ id3v2_frame_write_string (GstId3v2Frame * frame, int encoding, int terminator_length; if (encoding == ID3V2_ENCODING_UTF16_BOM) { gsize utf16len; - /* This converts to little-endian UTF-16, WITH a byte-order-marker */ + const guint8 bom[] = { 0xFF, 0xFE }; + /* This converts to little-endian UTF-16 */ gchar *utf16 = g_convert (string, -1, "UTF-16LE", "UTF-8", NULL, &utf16len, NULL); if (!utf16) { @@ -371,6 +372,8 @@ id3v2_frame_write_string (GstId3v2Frame * frame, int encoding, return; } + /* Write the BOM */ + id3v2_frame_write_bytes (frame, (const guint8 *) bom, 2); /* NUL terminator is 2 bytes, if present */ terminator_length = null_terminate ? 2 : 0; id3v2_frame_write_bytes (frame, (const guint8 *) utf16,