Problem with é, ö and so on.

G

Gerrit

Hello,

I have made a little program to create a playlist of all the mp3 's in a
folder. That work fine for me, but I have a problem with special characters
like é and ó.

In my playlist, they are good, but when I open the playlist in WinAmp, then
André becames: André

When I create a new playlist in WinAmp, and I open it again, then André
still is André.

When I open the playlists in Notepad, then the seems not different.

I use the code from this page:
http://www.codeproject.com/csharp/shellid3tagreader.asp to get the filename,
artist name and so on from the mp3.

I write my playlist with this code (with a little bit Dutch in it, but I
think you can understand):

public void Create()
{
DirectoryInfo dir = new DirectoryInfo(Pad);
FileInfo[] files = dir.GetFiles("*.mp3");

// Playlist opslaan
StreamWriter sw = new StreamWriter(dir.FullName + "\\" + fileName);

sw.WriteLine("#EXTM3U");
sw.WriteLine();

Mp3Bestand[] file = new Mp3Bestand[files.Length];
int t = 0;

foreach (FileInfo fi in files)
{
MP3File mp3File = ShellID3TagReader.ReadID3Tags(fi.FullName);
file[t] = new Mp3Bestand();
file[t].TrackNumber = mp3File.TrackNumber;
file[t].Length = mp3File.Lengte;
file[t].Artist = mp3File.ArtistName;
file[t].Title = mp3File.SongTitle;
file[t].FileName = mp3File.FileName;
t++;
}

Array.Sort(file);

foreach (Mp3Bestand file in file)
{
sw.WriteLine("#EXTINF:" + file.Length + "," + file.Artist + " - " +
file.Title);
sw.WriteLine(file.FileName);
sw.WriteLine();
}

sw.Close();
}

Does do you know a solution for this problem?
 
M

Martin Honnen

Gerrit said:
StreamWriter sw = new StreamWriter(dir.FullName + "\\" + fileName);

Can you try
StreamWriter sw = new StreamWriter(dir.FullName + "\\" + fileName,
System.Text.Encoding.Default);
instead?
Your current code writes an UTF-8 encoded file, perhaps WinAmp expects
the file encoded as e.g. Windows-1252 or the system's default code page.
 
G

Gerrit

Martin Honnen said:
Can you try
StreamWriter sw = new StreamWriter(dir.FullName + "\\" + fileName,
System.Text.Encoding.Default);
instead?
Your current code writes an UTF-8 encoded file, perhaps WinAmp expects the
file encoded as e.g. Windows-1252 or the system's default code page.

Ok, I 've tryed and I think this is the solution

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top