Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

Problem with é, ö and so on.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerrit - 19 Nov 2006 12:08 GMT
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?
Martin Honnen - 19 Nov 2006 14:19 GMT
>     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.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Gerrit - 19 Nov 2006 20:47 GMT
>>     StreamWriter sw = new StreamWriter(dir.FullName + "\\" + fileName);
>
[quoted text clipped - 4 lines]
> 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!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.