Bug 8410 - Add possibility force SqueezeCenter into UTF-8 mode where no such locale is available
: Add possibility force SqueezeCenter into UTF-8 mode where no such locale is a...
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Misc
: unspecified
: PC Linux (other)
: P2 enhancement (vote)
: 7.x
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-13 11:07 UTC by Philippe Kehl
Modified: 2009-09-08 09:12 UTC (History)
0 users

See Also:
Category: ---


Attachments
suggested patch to add a --forceutf8 command line flag (1.26 KB, patch)
2008-06-13 11:07 UTC, Philippe Kehl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Kehl 2008-06-13 11:07:43 UTC
Created attachment 3428 [details]
suggested patch to add a --forceutf8 command line flag

Hello

I'm suggesting a means to force SC into UTF-8 mode.

On a Linux system filenames can be encoded as UTF-8 even if no UTF-8 locale is available/compiled/configured.

E.g. if Samba is configured to save UTF-8 encoded filenames or the user transfers the files with UTF-8 encoded filenames to the server with no recoding, you'll end up with UTF-8 encoded filenames on the server independent from what charset is configured/available on the system (or for the user).

This is the situation on many NAS. In SSODS I included a simple patch that modified the SC source to force SC to interpret the filenames as if they were UTF-8 encoded. This has worked beautifully for a long time now for all versions of SS/SC (SS 6.x - SC 7.2).

The attached patch adds an command line flag --forceutf8 which does what I request. I'm not sure if it's good code, though.

Regards,
flip

http://forums.slimdevices.com/showthread.php?p=311523
Comment 1 Chris Owens 2008-06-19 10:19:56 UTC
Assigned to Michael to review.  

Note we have a steady stream of linux users with encoding/locale problems, so I am happy to do something that might help them if it's not too risky.
Comment 2 Philippe Kehl 2008-06-19 10:55:01 UTC
AFAIK the code works as follows: if there's no LC_CTYPE environment variable or if Perl's POSIX::setlocale() fails on it, the default is C. This then lead to the default charset iso-8859-1.

We could as well provide a command line option to change this default charset. Something like --default-charset=<iso-8859-1|utf8|euc-jp|...>.

--force-charset would be stronger and would override a present and working LC_CTYPE environment. This would only make sense if the user is unable to change the locale settings of his system, which is not what I would expect.

Hence, --default-charset, which only kicks in if there's no (working) LC_CTYPE, seems more reasonable to me.

What exactly are the "encoding/locale problems"? Wrongly displayed file names?
Comment 3 Michael Herger 2008-06-24 00:34:55 UTC
change 21067 - thanks! I made this a "charset=xyz" option though most will ever use it to force utf8
Comment 4 Chris Owens 2008-07-30 15:31:15 UTC
This bug has now been fixed in the 7.1 release version of SqueezeCenter!  Please download the new version from http://www.slimdevices.com if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Comment 5 Chris Owens 2009-07-31 10:22:43 UTC
Reduce number of active targets for SC