Umlauts in Importer and Flashplayer

Having trouble installing AmpJuke ?
Check this.

Umlauts in Importer and Flashplayer

Postby Milchmann on 26-08-2010 11:17

First of all: Thanks for this really nice software :)

Umlauts like ÄÖÜäöü are not displayed in the Flashplayer. Artist like Björk are turned into B€JOUML;RK and if you have & as a Forbidden Character it is BJOUML;RK.

Maybe some function in ampjuke is escaping the umlauts as it is usual in html (e.g. ö for ö) but the flash player is ignoring this.

And the Scan2.php shows Björk as Björk. (There's no escaping in the source-code.)

It would be nice if this could be fixed.

thanks

david

---

PS: I noticed that some translation in the German language file are missing. Is somebody on this already? If not I'll do it.
Milchmann
Newbie
Newbie
 
Posts: 4
Joined: 26-08-2010 11:01

Re: Umlauts in Importer and Flashplayer

Postby Michael on 27-08-2010 09:47

Hi david,

Thanks for posting and welcome to the AmpJuke forum.
...and thanks for the nice words about AmpJuke :D

It looks like you're right.
I'll look into it later and see what can be done.

//Michael.

P.S.: No, German isn't currently being updated by anyone.
Your contribution/translation will be highly appreciated. Let me know if anything is unclear in relation to how to do a translation.
User avatar
Michael
Site Admin
Site Admin
 
Posts: 449
Joined: 03-07-2007 13:46
Location: Denmark

Re: Umlauts in Importer and Flashplayer

Postby Michael on 11-09-2010 11:00

Hi david,

A quick update in relation to this.

I've tried various things. So far without success. I also asked Google for help but to no avail.
My preliminary conclusion: There's no possibility to 'adjust' for local characters in the XSPF flash player :|

However, it's possible to do a 'rewrite' of stuff. For example, the attached function (more later) will do a 'rewrite' of Danish characters Æ (ae), Ø (oe) and Å (aa).
I'm unsure if something similar can be used in relation to German..?

Anyway, I've experimented with replacing Danish characters from "&aelig" to "ae" (æ) etc.
This is done in the function xspf_write_track. It's located in disp.php.

Replace your own copy of xspf_write_track with the attached function. Also replace the 3-4 lines in the section "Handle 'local' characters:" within xspf_write_track. I'm sure you'll understand once you take a look at it.

As mentioned, it's attached. It's the best I can do for now.

//Michael.

Here's the code:
Code: Select all
function xspf_write_track($user,$row,$name,$ext) { // Write a single track-entry to a specific XSPF playlist:
   $handle=fopen('./tmp/'.$user.session_id().'.xspf', 'a');
   fwrite($handle,'<track>'.chr(13).chr(10));
   include('db.php');

// Good,old reliable method. Not desirable though, since this expects a copy to exist in ./tmp:
//   fwrite($handle,'<location>'.$base_http_prog_dir.'/tmp/'.$row['id'].$ext.'</location>'.chr(13).chr(10));

// Use AmpJuke's built-in streaming engine, even though we know http-locations are expected within .xspf:
   $l=$base_http_prog_dir.'/stream.php?id='.$row['id'];
   $l.='&user_id='.get_user_id($user);
   $l.='&upw='.get_md5_passwd($user);
   fwrite($handle,'<location>'.$l.'</location>'.chr(13).chr(10));

   // Handle 'local' characters:
   $name=htmlentities($name); // Convert to 'entities' -> then make a search&replace for each char.:
   $name=str_replace('&aelig;','AE',$name); // æ -> ae
   $name=str_replace('&oslash;','OE',$name); // ø -> oe
   $name=str_replace('&aring;','AA',$name); // ø -> oe   

   // Name to display:
   $s=array('.mp3','_');
   $name=str_replace($s,' ',$name);
   fwrite($handle,'<title>'.$name.'</title>'.chr(13).chr(10));
   fwrite($handle,'<annotation>'.$name.'</annotoation>').chr(13).chr(10);
   // Link directly to the performer's page:
   $l=$base_http_prog_dir.'/index.php?what=performerid&start=0&special='.$row['performer_id'];
   fwrite($handle,'<info>'.$l.'</info>'.chr(13).chr(10));

   // Do we have an image of the performer ?
   if (file_exists('./lastfm/'.$row['performer_id'].'.jpg')) {
      fwrite($handle,'<image>'.$base_http_prog_dir.'/lastfm/'.$row['performer_id'].'.jpg</image>'.chr(13).chr(10));
   } else { // Just add the usual stuff:
      fwrite($handle,'<image>'.$base_http_prog_dir.'/covers/_blank.jpg</image>'.chr(13).chr(10));
   }   

   fwrite($handle,'</track>'.chr(13).chr(10));
   fclose($handle);
   /* Noooo...really..?
   if ((isset($xspf_update_stats)) && ($xspf_update_stats=='1')) {
      update_stats($row['id']);
   }
   */   
}   
User avatar
Michael
Site Admin
Site Admin
 
Posts: 449
Joined: 03-07-2007 13:46
Location: Denmark

Re: Umlauts in Importer and Flashplayer

Postby Milchmann on 14-09-2010 12:43

Thanks Michael. Heres how the German-Umlauts can be converted:

Code: Select all
$name=str_replace('&auml;','AE',$name); // ä -> AE
$name=str_replace('&ouml;','OE',$name); // ö -> OE
$name=str_replace('&uuml;','UE',$name); // ü -> UE
$name=str_replace('&szlig;','SS',$name); // ß -> SS


I've converted from lowercase to uppercase as you did in your example. Uppercase Umlauts have a different notation &Auml; &Ouml; and &Uuml; (there is no uppercase ß).
Milchmann
Newbie
Newbie
 
Posts: 4
Joined: 26-08-2010 11:01


Return to Installation / support

Who is online

Users browsing this forum: No registered users and 1 guest

cron