Posted by Nimo on March 23, 2009 at 1:15pm
Jump to:
| Project: | FileField Podcaster |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
Swedish characters in id3 artist field makes author tag in podcast feed empty.
Workaround that I got working:
Add following to the top of ffpc_row_plugin_podcast.inc
<?php
function unhtmlspecialchars($string)
{
$string = str_replace ( 'å', 'å', $string );
$string = str_replace ( 'Å', 'Å', $string );
$string = str_replace ( 'ä', 'ä', $string );
$string = str_replace ( 'Ä', 'Ä', $string );
$string = str_replace ( 'ö', 'ö', $string );
$string = str_replace ( 'Ö', 'Ö', $string );
$string = str_replace ( 'å', 'å', $string );
$string = str_replace ( 'Å', 'Å', $string );
$string = str_replace ( 'ä', 'ä', $string );
$string = str_replace ( 'Ä', 'Ä', $string );
$string = str_replace ( 'ö', 'ö', $string );
$string = str_replace ( 'Ö', 'Ö', $string );
return $string;
}
?>Search for:
<?php
'value' => $info['tags_html']['id3v2']['artist'][0],
?>and replace the line with:
<?php
'value' => unhtmlspecialchars($info['tags_html']['id3v2']['artist'][0]),
?>Maybe there is an better solution?
Comments
#1
Typo. You should search for $info['tags'] and replace with $info['tags_html'].
Ie:
Search for:
<?php'value' => $info['tags']['id3v2']['artist'][0],
?>
and replace the line with:
<?php'value' => unhtmlspecialchars($info['tags_html']['id3v2']['artist'][0]),
?>
Correct function to add:
<?phpfunction unhtmlspecialchars($string)
{
$string = str_replace ( '&#229;', 'å', $string );
$string = str_replace ( '&#197;', 'Å', $string );
$string = str_replace ( '&#228;', 'ä', $string );
$string = str_replace ( '&#196;', 'Ä', $string );
$string = str_replace ( '&#246;', 'ö', $string );
$string = str_replace ( '&#214;', 'Ö', $string );
$string = str_replace ( 'å', 'å', $string );
$string = str_replace ( 'Å', 'Å', $string );
$string = str_replace ( 'ä', 'ä', $string );
$string = str_replace ( 'Ä', 'Ä', $string );
$string = str_replace ( 'ö', 'ö', $string );
$string = str_replace ( 'Ö', 'Ö', $string );
return $string;
}
?>
And for some reason my html-entities above got lost and was transformed into real characters - how to write them correctly?
(In the meanwhile replace & with &)
#2
This definitely needs work. The code listed here isn't really compatible with internationalization. This may be an issue with getID3 or our use of it.
#3
#4
Oh ! Didn't see this issue before... perhaps the swedish characters problems is the same as mine :
http://drupal.org/node/822584