Bugzilla – Bug 3327
Em Dash not displaying correctly on SqueezeBox
Last modified: 2008-12-15 11:58:02 UTC
Track titles containing an Em Dash (unicode U+2014) don't display correctly on the squeezebox. The dash is replaced by a '?'. This is happening in Locale::Hebrew::hebrewflip(). Adding: print $string . "\n"; before and after line 224 of Slim::Display::Graphics (r7144) illustrates this, and commenting out this line fixes the problem.
I've had a look in Locale::Hebrew::hebrewflip, and it seems that this occurs because all strings are converted to iso-8859-8, which doesn't have an Em-Dash, then back to utf8 after the reversal. Would a sensible workaround hence be to only call hebrewflip if any Hebrew characters are contained in the string. I've created a patch implementing this workaround which seems to work, but I don't really have the means to test it properly: Index: Graphics.pm =================================================================== --- Graphics.pm (revision 7153) +++ Graphics.pm (working copy) @@ -221,8 +221,14 @@ } # if we've got non latin characters, make sure the hebrew is in the right order for printing if ($canUseBiDi) { - $string = Locale::Hebrew::hebrewflip($string); - @ords = (); + # Bug 3327 - only call hebrewflip if the string contains hebrew characters + foreach my $ord (@ords) { + if ($ord >= 0x05D0 && $ord <= 0x05EA) { + $string = Locale::Hebrew::hebrewflip($string); + @ords = (); + last; + } + } } @ords = unpack($unpackTemplate, $string) unless @ords;
Created attachment 1216 [details] Only call hebrewflip if we have characters in the ranges 0590-05FF and FB00-FB4F
Comment on attachment 1216 [details] Only call hebrewflip if we have characters in the ranges 0590-05FF and FB00-FB4F patches Slim::Display::Graphics.pm
Created attachment 1217 [details] Only call hebrewflip if we have right to left characters in the string. far better version above from Triode that uses a regexp
Looks good. A Hebrew file is at http://electricrain.com/daniel/hebrew.mp3
(In reply to comment #5) > Looks good. > A Hebrew file is at http://electricrain.com/daniel/hebrew.mp3 Works for me with that file so I've committed the changes. There'll still be problems with anything containing right to left characters outside ISO8859-8 though. Shall I add an enhancement request for a full bidi implemenation?
I don't see any '?' characters in the text displayed when this file is played. I'll call that verified in SlimServer Version: 6.3.0 - 7895 - Windows XP - EN - cp1252
This bug has been fixed in the latest release of SqueezeCenter! Please download the new version from http://www.slimdevices.com/su_downloads.html 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.