Witam,

Chciałbym wykorzystać taki oto mp3 player na swojej stronie:
http://www.cantabileband.pl/mp3.html

Wszystko ładnie wyświetla, problem jednak polega na tym że nie chcą się włączyć piosenki które mają polskie znaki w nazwie.

Myślę że to jest ten istotny fragment kodu który należałoby poprawić.

  1. <?php
  2. $exclude_files = array(
  3. "_derived",
  4. "_private",
  5. "_vti_cnf",
  6. "_vti_pvt",
  7. "vti_script",
  8. "_vti_txt"
  9. ); // add any other folders or files you wish to exclude from the player.
  10.  
  11.  
  12. //READING ID3 TAGS
  13.  
  14.  
  15. // id3 tags converting to utf-8
  16. function conv($str) {
  17.  
  18. for ( $i = 0, $length = strlen($str); $i < $length; $i++ ) {
  19.  
  20.  
  21. if((ord($str[$i])=='0'||ord($str[$i])=='4')){
  22. $str1 = $str1;
  23.  
  24. }else{ $str1 = $str1.$str[$i];}
  25.  
  26.  
  27. }
  28.  
  29.  
  30. if( ( strpos($str1,chr(209).chr(143).chr(209).chr(142)) === 0) )
  31. { $str2 = substr($str1, 4); $str1 = $str2;}else{$str1 = $str1;}
  32.  
  33. return $str1;
  34. }
  35.  
  36.  
  37. function detectUTF8($string)
  38. {
  39. return preg_match('%(?:
  40. [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
  41. |\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
  42. |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
  43. |\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
  44. |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
  45. |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
  46. |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
  47. )+%xs', $string);
  48. }
  49.  
  50. function cp1251_utf8( $sInput )
  51. {
  52. $sOutput = "";
  53.  
  54. for ( $i = 0; $i < strlen( $sInput ); $i++ )
  55. {
  56. $iAscii = ord( $sInput[$i] );
  57.  
  58. if ( $iAscii >= 192 && $iAscii <= 255 )
  59. $sOutput .= "&#".( 1040 + ( $iAscii - 192 ) ).";";
  60. else if ( $iAscii == 168 )
  61. $sOutput .= "&#".( 1025 ).";";
  62. else if ( $iAscii == 184 )
  63. $sOutput .= "&#".( 1105 ).";";
  64. else
  65. $sOutput .= $sInput[$i];
  66. }
  67.  
  68. return $sOutput;
  69. }
  70.  
  71. function encoding($string){
  72. if (function_exists('iconv')) {
  73. if (@!iconv('utf-8', 'cp1251', $string)) {
  74. $string = iconv('cp1251', 'utf-8', $string);
  75. }
  76. return $string;
  77. } else {
  78. if (detectUTF8($string)) {
  79. return $string;
  80. } else {
  81. return cp1251_utf8($string);
  82. }
  83. }
  84. }
  85.  
  86.  



Proszę o pomoc.
Pozdrawiam,