Swedish characters in id3 artist field makes author tag in podcast feed empty
Nimo - March 23, 2009 - 13:15
| Project: | FileField Podcaster |
| Version: | 6.x-0.7 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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?

#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 &)