Bug 3271 - Template engine doesn't handle UTF-8 characters correctly
: Template engine doesn't handle UTF-8 characters correctly
Status: RESOLVED PATCHWELCOME
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: unspecified
: Macintosh MacOS X 10
: P2 normal (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-13 19:37 UTC by Barry Klawans
Modified: 2011-03-16 04:18 UTC (History)
0 users

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Klawans 2006-04-13 19:37:38 UTC
I've been doing a bunch of Unicode testing of the SlimServer, and have one problem that I can't get past.  The Template Toolkit used to process the various skin's web pages doesn't handle UTF-8 characters correctly, which causes some serious problems with certain skins.

This is easily noticed with the Location field - paths to files that have utf-8 encoded Unicode characters in their name do not display properly.  I narrowed it down to the template engine by adding a new filter that produces a hex dump of the current string, and add the appropriate code to songinfo.html to display itemobj.path as hex, the hex dump shows the correct utf-8 encoding for itemobj.path, so it is being passed in to the template correctly.  (This is good - it shows that the SlimServer is doing everything OK.)  The resulting page returned from the template engine contains the incorrectly encoded character.  (In fact, a single "a-acute" comes back as four bytes.)

Some skins break because of this.  For example, the EN skin (used by Bagpuss and others) include the path to the actual file as part of the "Play this song" link.  Since the path is encoded wrong by the templating engine, the resulting link contains the incorrect path, and fails.

There might be another bug here, that some skins use the ID of the track for playing it, and some use the path.

I'm not a perl programmer, so debugging the template code is going to take more time than I have right now.  I'd be happy to work with the Slim folks on this, and pass on some of the tools I'm using, like the "hexdump" filter.

FYI, tested on both OS X 10.3.9 and 10.4.5, both using perl 5.8.6.
Comment 1 KDF 2006-04-13 19:50:16 UTC
please refer to the trunk for this stuff.  Much of the reliance on path is long gone as part of 6.5 development work.
Comment 2 Barry Klawans 2006-04-14 10:32:02 UTC
I have looked at the trunk, and knew it was fixed there.  I filed this because I think it is useful to other users who may run into the same problem to have a bug filed so they can find out that it is a known issue and is being addressed.