Changeset 6356


Ignore:
Timestamp:
May 25, 2010, 9:55:28 PM (14 years ago)
Author:
rvelices
Message:

merge -r 6355 from trunk
fix bug 1663 : wrong decoding of non Ascii iptc/exif (charset issue)

Location:
branches/2.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/admin/include/languages.class.php

    • Property svn:eol-style set to LF
    r5452 r6356  
    9999          break;
    100100        }
    101        
     101
    102102        $query = "
    103103DELETE
     
    148148  /**
    149149  *  Get languages defined in the language directory
    150   */ 
     150  */
    151151  function get_fs_languages($target_charset = null)
    152152  {
     
    166166        list($language_name) = @file($path.'/iso.txt');
    167167
    168         $languages[$file] = convert_charset($language_name, $target_charset);
     168        $languages[$file] = convert_charset($language_name, 'utf-8', $target_charset);
    169169      }
    170170    }
  • branches/2.1/include/functions.inc.php

    • Property svn:mergeinfo deleted
    r6060 r6356  
    383383{
    384384  $raw = $str;
    385  
     385
    386386  $str = remove_accents($str);
    387387  $str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str));
     
    12671267            if ( is_array($v) )
    12681268            {
    1269               $func = create_function('$v', 'return convert_charset($v, "'.$target_charset.'");' );
     1269              $func = create_function('$v', 'return convert_charset($v, "utf-8", "'.$target_charset.'");' );
    12701270              $lang[$k] = array_map($func, $v);
    12711271            }
    12721272            else
    1273               $lang[$k] = convert_charset($v, $target_charset);
     1273              $lang[$k] = convert_charset($v, 'utf-8', $target_charset);
    12741274          }
    12751275        }
     
    12781278          foreach ($load_lang_info as $k => $v)
    12791279          {
    1280             $lang_info[$k] = convert_charset($v, $target_charset);
     1280            $lang_info[$k] = convert_charset($v, 'utf-8', $target_charset);
    12811281          }
    12821282        }
     
    12921292    {
    12931293      $content = @file_get_contents($source_file);
    1294       $content = convert_charset($content, $target_charset);
     1294      $content = convert_charset($content, 'utf-8', $target_charset);
    12951295      return $content;
    12961296    }
     
    13001300
    13011301/**
    1302  * converts a string from utf-8 character set to another character set
     1302 * converts a string from a character set to another character set
    13031303 * @param string str the string to be converted
     1304 * @param string source_charset the character set in which the string is encoded
    13041305 * @param string dest_charset the destination character set
    13051306 */
    1306 function convert_charset($str, $dest_charset)
    1307 {
    1308   if ($dest_charset=='utf-8')
    1309   {
     1307function convert_charset($str, $source_charset, $dest_charset)
     1308{
     1309  if ($source_charset==$dest_charset)
    13101310    return $str;
    1311   }
    1312   if ($dest_charset=='iso-8859-1')
     1311  if ($source_charset=='iso-8859-1' and $dest_charset=='utf-8')
     1312  {
     1313    return utf8_encode($str);
     1314  }
     1315  if ($source_charset=='utf-8' and $dest_charset=='iso-8859-1')
    13131316  {
    13141317    return utf8_decode($str);
     
    13161319  if (function_exists('iconv'))
    13171320  {
    1318     return iconv('utf-8', $dest_charset, $str);
     1321    return iconv($source_charset, $dest_charset, $str);
    13191322  }
    13201323  if (function_exists('mb_convert_encoding'))
    13211324  {
    1322     return mb_convert_encoding( $str, $dest_charset, 'utf-8' );
     1325    return mb_convert_encoding( $str, $dest_charset, $source_charset );
    13231326  }
    13241327  return $str; //???
     
    15371540{
    15381541  global $conf;
    1539  
     1542
    15401543  $options = array();
    15411544  foreach (array_reverse($conf['available_permission_levels']) as $level)
    15421545  {
    15431546    $label = null;
    1544  
     1547
    15451548    if (0 == $level)
    15461549    {
     
    15671570          );
    15681571      }
    1569      
     1572
    15701573      $label = implode(', ', $labels);
    15711574    }
Note: See TracChangeset for help on using the changeset viewer.