Author: abock
Date: 2005-11-27 22:10:10 -0500 (Sun, 27 Nov 2005)
New Revision: 53535

Modified:
   trunk/entagged-sharp/ChangeLog
   trunk/entagged-sharp/src/Mp3/Util/Id3v1TagReader.cs
Log:
2005-11-27  Aaron Bockover  <[EMAIL PROTECTED]>

    * src/Mp3/Util/Id3v1TagReader.cs: Use ValidateUtf8() when reading tags
    to see if the tag can be parsed as UTF-8 or fall back on ISO-8859-1


Modified: trunk/entagged-sharp/ChangeLog
===================================================================
--- trunk/entagged-sharp/ChangeLog      2005-11-28 03:06:35 UTC (rev 53534)
+++ trunk/entagged-sharp/ChangeLog      2005-11-28 03:10:10 UTC (rev 53535)
@@ -1,5 +1,7 @@
 2005-11-27  Aaron Bockover  <[EMAIL PROTECTED]>
 
+       * src/Mp3/Util/Id3v1TagReader.cs: Use ValidateUtf8() when reading tags
+       to see if the tag can be parsed as UTF-8 or fall back on ISO-8859-1
        * src/Util/Utils.cs: Added the UnicodeValidator class here
        * src/EncodingInfo.cs: Ugh, reversed the previous patch... that class
        really doesn't belong in this file ;)

Modified: trunk/entagged-sharp/src/Mp3/Util/Id3v1TagReader.cs
===================================================================
--- trunk/entagged-sharp/src/Mp3/Util/Id3v1TagReader.cs 2005-11-28 03:06:35 UTC 
(rev 53534)
+++ trunk/entagged-sharp/src/Mp3/Util/Id3v1TagReader.cs 2005-11-28 03:10:10 UTC 
(rev 53535)
@@ -76,7 +76,12 @@
                {
                        byte[] b = new byte[length];
                        mp3Stream.Read( b, 0, b.Length );
-                       string ret = 
Encoding.GetEncoding("ISO-8859-1").GetString(b).Trim();
+                       string ret;
+                       
+            if(Entagged.Audioformats.Util.UnicodeValidator.ValidateUtf8(b))
+                ret = Encoding.UTF8.GetString(b).Trim();
+            else 
+                ret = Encoding.GetEncoding("ISO-8859-1").GetString(b).Trim();
 
                        int pos = ret.IndexOf('\0');
                        if (pos != -1)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to