Bug 15052 - Album favorites with non-latin characters are broken
: Album favorites with non-latin characters are broken
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Localization
: 7.4.1
: PC Ubuntu Linux
: P2 normal (vote)
: 7.5.0
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-11-04 15:38 UTC by chrismuller@gmx.net
Modified: 2010-04-08 17:26 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
Patch (483 bytes, patch)
2009-11-04 15:38 UTC, chrismuller@gmx.net
Details | Diff
Revised Patch for Bug 15052 (using utf8::decode) (557 bytes, application/octet-stream)
2009-11-19 02:54 UTC, chrismuller@gmx.net
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chrismuller@gmx.net 2009-11-04 15:38:02 UTC
Created attachment 6276 [details]
Patch

If you save an album with non-latin characters in the name as a favorite, the
favorite cannot be played (message: not found).

Example: 

Favorite (as shown in the edit text box in the web interface) reads as follows:

db:album.titlesearch=COMPTINES%20%C3%80%20CHANTER%20VOLUME%201

%C3%80 is URI escaped version of UTF-8 code for the "à" character

Fix: See patch below for Commands.pm

which changes the unescaping of the string. uri_unescape returns an octet
stream, which cannot be fed to Slim::Utils::Unicode::utf8decode (or the utf-8
character consisting of two octets will be interpreted as two characters).
Rather Encode::decode_utf8 should be used, which interprets the octet stream
correctly.



--- Commands.pm    2009-11-05 00:21:42.000000000 +0100
+++ Commands.pm.new    2009-11-05 00:09:26.000000000 +0100
@@ -3248,7 +3248,7 @@
             if ($term =~ /^(\w+)\.(\w+)=(.*)$/) {

                 my $key   = URI::Escape::uri_unescape($2);
-                my $value = Slim::Utils::Unicode::utf8decode(
URI::Escape::uri_unescape($3) );
+                my $value = Encode::decode_utf8( URI::Escape::uri_unescape($3)
);

                 $class = ucfirst($1);
                 $obj   = Slim::Schema->single( $class, { $key => $value } );
Comment 1 James Richardson 2009-11-05 14:36:47 UTC
Andy: is this a dupe of bug 14930
Comment 2 Andy Grundman 2009-11-06 12:04:40 UTC
*** Bug 14930 has been marked as a duplicate of this bug. ***
Comment 3 Andy Grundman 2009-11-06 12:06:59 UTC
I think it should probably use utf8::decode rather than Encode.
Comment 4 chrismuller@gmx.net 2009-11-18 13:12:00 UTC
(In reply to comment #3)
> I think it should probably use utf8::decode rather than Encode.

I have checked it out with utf8::decode. This also works perfectly fine. 

Why would you prefer utf8::decode over Encode::decode_utf8? The documentation of utf8::decode says "Note that this function does not handle arbitrary encodings. Therefore Encode is recommended for the general purposes;" 

I don't know whether arbitrary encodings could ever be an issue in our case.
Comment 5 Andy Grundman 2009-11-18 13:19:04 UTC
In this case we already know the data in the database is UTF-8, we don't store any other encoding.  Dealing with various other encodings is only an issue for the scanner.
Comment 6 chrismuller@gmx.net 2009-11-19 02:54:16 UTC
Created attachment 6324 [details]
Revised Patch for Bug 15052 (using utf8::decode)
Comment 7 Chris Owens 2009-12-18 16:25:02 UTC
Andy it seems like we have a bit of breathing room and the ability to fix a few more bugs.  Would you like to go ahead and submit this?  As always, I'd rather do it sooner than later so our beta users can check it out.
Comment 8 SVN Bot 2010-01-07 02:22:08 UTC
 == Auto-comment from SVN commit #29729 to the slim repo by michael ==
 == https://svn.slimdevices.com/slim?view=revision&revision=29729 ==

Fixed Bug: 15052 +0.5
Description: fix favorites encoding for albums - thanks Chris!

Tested on OSX & Windows XP
Comment 9 Chris Owens 2010-04-08 17:26:16 UTC
This bug has been marked fixed in a released version of Squeezebox Server or the accompanying firmware or mysqueezebox.com release.

If you are still seeing this issue, please let us know!