Index: Music/Info.pm =================================================================== --- Music/Info.pm (revision 28811) +++ Music/Info.pm (working copy) @@ -887,7 +887,7 @@ $j = (splitdir($j))[-1] || $j; } - return Slim::Utils::Unicode::utf8decode_locale($j); + return main::ISWINDOWS ? $j : Slim::Utils::Unicode::utf8decode_locale($j); } sub sortFilename { Index: Utils/Prefs.pm =================================================================== --- Utils/Prefs.pm (revision 28811) +++ Utils/Prefs.pm (working copy) @@ -100,8 +100,8 @@ my $prefs = preferences('server'); -# make sure these server prefs has the utf8flag turned off before they get used -$prefs->setUtf8Off(qw(audiodir playlistdir cachedir librarycachedir coverArt)); +# File paths need to be prepared in order to correctly read the file system +$prefs->setFilepaths(qw(audiodir playlistdir cachedir librarycachedir coverArt)); =head2 preferences( $namespace ) Index: Utils/Scanner.pm =================================================================== --- Utils/Scanner.pm (revision 28811) +++ Utils/Scanner.pm (working copy) @@ -126,6 +126,11 @@ return Slim::Utils::Misc::fileFilter($File::Next::dir, $_, $types); }; + + if (utf8::is_utf8($topDir)) { + utf8::encode($topDir); + } + my $iter = File::Next::files({ 'file_filter' => $file_filter, 'descend_filter' => $descend_filter, Index: Utils/Prefs/Base.pm =================================================================== --- Utils/Prefs/Base.pm (revision 28811) +++ Utils/Prefs/Base.pm (working copy) @@ -259,6 +259,10 @@ } } + if (main::ISWINDOWS && $root->{'filepathPrefs'}->{ $pref }) { + $new = Win32::GetANSIPathName($new); + } + $class->{'prefs'}->{ $pref } = $new; if ( !main::SLIM_SERVICE ) { # SN's timestamps are stored automatically Index: Utils/Prefs/Namespace.pm =================================================================== --- Utils/Prefs/Namespace.pm (revision 28811) +++ Utils/Prefs/Namespace.pm (working copy) @@ -25,6 +25,7 @@ use File::Spec::Functions qw(:ALL); use YAML::Syck; +use Slim::Utils::OSDetect; use Slim::Utils::Prefs::Client; use Slim::Utils::Log; use Slim::Utils::Unicode; @@ -80,7 +81,7 @@ 'validparam'=> {}, 'onchange' => {}, 'migratecb' => {}, - 'utf8off' => {}, + 'filepathPrefs' => {}, }, $ref; $class->{'prefs'} = $class->_load || { @@ -168,13 +169,9 @@ } -=head2 setUtf8off( list ) - -Turns off the utf8 flag for the preferences listed. This is normally used for folder prefernces -which may otherwise have the utf8 flag set when read in from YAML. +=head2 setFilepaths( list ) -This should be called as soon as a namespace is created before preferences are used to make sure -utf8 is turned off after reading in the namespace preference file. +Do some prefs manipulation for values storing a file or folder path. Only supports global (non client) prefs. @@ -182,9 +179,11 @@ =cut -sub setUtf8Off { +sub setFilepaths { my $class = shift; + return unless main::ISWINDOWS; + while (my $pref = shift) { if ( main::DEBUGLOG && $log->isInitialized && $log->is_debug ) { @@ -192,10 +191,10 @@ } if ( $class->{'prefs'}->{ $pref } ) { - $class->{'prefs'}->{ $pref } = Slim::Utils::Unicode::utf8off($class->{'prefs'}->{ $pref }); + $class->{'prefs'}->{ $pref } = Win32::GetANSIPathName($class->{'prefs'}->{ $pref }); } - $class->{'utf8off'}->{ $pref } = 1; + $class->{'filepathPrefs'}->{ $pref } = 1; } } @@ -264,9 +263,7 @@ main::INFOLOG && $log->info("can't read $class->{'file'} : $@"); } - foreach ( keys %{$class->{'utf8off'}} ) { - $prefs->{$_} = Slim::Utils::Unicode::utf8off($prefs->{$_}); - } + $class->setFilepaths(keys %{$class->{'filepathPrefs'}}); } return $prefs; Index: Web/Pages/BrowseTree.pm =================================================================== --- Web/Pages/BrowseTree.pm (revision 28811) +++ Web/Pages/BrowseTree.pm (working copy) @@ -128,8 +128,6 @@ my $descend = Slim::Music::Info::isList($item) || ($item->content_type eq 'unk' && -d Slim::Utils::Misc::pathFromMacAlias($url)); - # Turn the utf8 flag on for proper display - since this is - # coming directly from the filesystem. my %form = ( 'text' => $name || Slim::Music::Info::fileName($url), 'hierarchy' => join('/', @levels, $item->id),