Bug 3327 - Em Dash not displaying correctly on SqueezeBox
: Em Dash not displaying correctly on SqueezeBox
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Localization
: 6.5b1
: PC Windows XP
: P2 normal (vote)
: ---
Assigned To: Chris Owens
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-26 12:30 UTC by Christopher Key
Modified: 2008-12-15 11:58 UTC (History)
0 users

See Also:
Category: ---


Attachments
Only call hebrewflip if we have characters in the ranges 0590-05FF and FB00-FB4F (871 bytes, patch)
2006-04-30 11:14 UTC, Christopher Key
Details | Diff
Only call hebrewflip if we have right to left characters in the string. (503 bytes, patch)
2006-04-30 12:37 UTC, Christopher Key
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Key 2006-04-26 12:30:32 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.
Comment 1 Christopher Key 2006-04-26 17:02:47 UTC
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;
 
Comment 2 Christopher Key 2006-04-30 11:14:27 UTC
Created attachment 1216 [details]
Only call hebrewflip if we have characters in the ranges 0590-05FF and FB00-FB4F
Comment 3 Christopher Key 2006-04-30 11:23:13 UTC
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
Comment 4 Christopher Key 2006-04-30 12:37:00 UTC
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
Comment 5 Dan Sully 2006-04-30 12:46:18 UTC
Looks good.

A Hebrew file is at http://electricrain.com/daniel/hebrew.mp3
Comment 6 Christopher Key 2006-04-30 13:16:06 UTC
(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?
Comment 7 Chris Owens 2006-06-12 17:13:10 UTC
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
Comment 8 James Richardson 2008-12-15 11:58:02 UTC
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.