sirpelidor


Hello there, I hope I post at the right forum Smile

I have download and install a COM library call: CDDBControl.dll
can be find at: http://www.motobit.com/tips/detpg_change-id3-tags-script/

my objective is to batch change ID3 tags for my mp3s.

my problem is I can batch change if the file path is in English, but it won't work if file path is in other languages (i.e. chinese).

I don't know if this is COM limitation or simply I didn't pass in the correct encoding, I hope I can get some help here Smile

here's my sample code which works (and comment out the one that doesn't work)

Code Snippet

Dim id3 As New CDDBCONTROLLib.CddbID3Tag
'file1 will crash, where file2 will work

Dim file1 As String = "C:\.mp3"
Dim file2 As String = "C:\sample.mp3"
Try
id3.LoadFromFile(file2, False)
Catch ex As Exception
Console.WriteLine(ex.ToString())
Return
End Try

'display artist

Console.WriteLine(id3.LeadArtist)




Re: .NET Base Class Library does COM wrapper through .NET only understands english?

nobugz

It sure sounds like the COM component doesn't properly handle Unicode characters in a path. Not unusual for older stuff produced by western programmers. Try to get support from motobit.com. Looks like a one-guy operation, help@pstruh.cz





Re: .NET Base Class Library does COM wrapper through .NET only understands english?

DotNetHeaven

Or better still, use a .NET native library to manage your collection of MP3s.

http://sourceforge.net/projects/csid3lib

http://developer.novell.com/wiki/index.php/TagLib_Sharp





Re: .NET Base Class Library does COM wrapper through .NET only understands english?

sirpelidor

nobugz, dotnetheaven, thank you very much for the tip.

dotnetheave,

I go ahead and try novell's TagLib_Sharp, I'm now able to load the mp3 into object, but then I'm having trouble to write my title into languages other then english. Do you happen have any idea

this is my code:


string path = "c:/test.mp3";
try
{
TagLib.File file = TagLib.File.Create(path);
file.Tag.Title = ""; //big5 chinese char
file.Save();
}
catch (Exception e)
{
Console.Write(e.ToString());
return;
}



upon complete, both window (right click properties, Summary tab) and iTunes (after file imported into library) will only recongize the mp3 file as .mp3 instead of .mp3

I must be running into some encoding problem such as the object might still read my string as UTF-8 or something, yet i'm not sure where to fix that Stick out tongue




Re: .NET Base Class Library does COM wrapper through .NET only understands english?

DotNetHeaven

I'm neither familiar with that library nor Chinese. .NET is based on Unicode though, so I would have thought multibyte character strings were handled gracefully without any modification. However, I'm not sure about the ID3 specification. It's possible that it only supports UTF-8 strings and therefore the library converts to UTF-8 before writing them. If ID3 only supports UTF-8 (which I'm pretty sure version 1 did but then I don't know about the most recent version) then I'm afraid you won't be able to use Chinese in your ID3 tags Sad

If a more recent version of ID3 supports Unicode, you may have to specify the version somewhere before you save the file.

Best of luck

Smile