Index: trunk/flactrack
===================================================================
--- trunk/flactrack	(revision 13)
+++ trunk/flactrack	(revision 15)
@@ -15,4 +15,5 @@
 use Audio::FLAC::Header;
 use MusicBrainz;
+use Text::Unidecode;
 
 GetOptions(
@@ -22,4 +23,5 @@
     'all|a' => \my $ALL,
     'dir|d=s' => \my $DIRECTORY,
+    'ascii-tags' => \my $ASCII_TAGS,
 );
 
@@ -41,5 +43,6 @@
         require Config::Properties;
 
-        my $properties = Config::Properties->new(file => $properties_file);
+        # the properties are in UTF-8; mark them as such so unidecode works correctly later
+        my $properties = Config::Properties->new(file => $properties_file, encoding => 'utf8');
         $info = $properties->getProperties;
     } else {
@@ -103,8 +106,9 @@
         if ($info) {
             my $track_key = sprintf 'TRACK%02d', $tracknum;
-            $cmd .= sprintf q{ --tt %s --ta %s --tl %s --tn %d},
-                quote($info->{"$track_key.TITLE"}),
-                quote($info->{"$track_key.ARTIST"}),
-                quote($info->{ALBUM}),
+            $cmd .= sprintf q{ --tt %s --ta %s --tl %s --ty %d --tn %d},
+                quote($ASCII_TAGS ? unidecode($info->{"$track_key.TITLE"}) : $info->{"$track_key.TITLE"}),
+                quote($ASCII_TAGS ? unidecode($info->{"$track_key.ARTIST"}) : $info->{"$track_key.ARTIST"}),
+                quote($ASCII_TAGS ? unidecode($info->{ALBUM}) : $info->{ALBUM}),
+                ($info->{ORIGINALDATE} =~ /^(\d\d\d\d)/)[0],
                 $tracknum;
         }
@@ -130,7 +134,7 @@
 sub to_filename {
     my @strings = @_;
-    #TODO: deal with non-ascii characters (unidecode) e.g. ü --> ue
     return map {
         s/&/ and /g;
+        unidecode($_);
         s/[^a-z0-9-_ ]+//gi;
         s/ +/_/g;
