Changeset 6356 for branches/2.1/include/functions.inc.php
- Timestamp:
- May 25, 2010, 9:55:28 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1/include/functions.inc.php
- Property svn:mergeinfo deleted
r6060 r6356 383 383 { 384 384 $raw = $str; 385 385 386 386 $str = remove_accents($str); 387 387 $str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str)); … … 1267 1267 if ( is_array($v) ) 1268 1268 { 1269 $func = create_function('$v', 'return convert_charset($v, " '.$target_charset.'");' );1269 $func = create_function('$v', 'return convert_charset($v, "utf-8", "'.$target_charset.'");' ); 1270 1270 $lang[$k] = array_map($func, $v); 1271 1271 } 1272 1272 else 1273 $lang[$k] = convert_charset($v, $target_charset);1273 $lang[$k] = convert_charset($v, 'utf-8', $target_charset); 1274 1274 } 1275 1275 } … … 1278 1278 foreach ($load_lang_info as $k => $v) 1279 1279 { 1280 $lang_info[$k] = convert_charset($v, $target_charset);1280 $lang_info[$k] = convert_charset($v, 'utf-8', $target_charset); 1281 1281 } 1282 1282 } … … 1292 1292 { 1293 1293 $content = @file_get_contents($source_file); 1294 $content = convert_charset($content, $target_charset);1294 $content = convert_charset($content, 'utf-8', $target_charset); 1295 1295 return $content; 1296 1296 } … … 1300 1300 1301 1301 /** 1302 * converts a string from utf-8character set to another character set1302 * converts a string from a character set to another character set 1303 1303 * @param string str the string to be converted 1304 * @param string source_charset the character set in which the string is encoded 1304 1305 * @param string dest_charset the destination character set 1305 1306 */ 1306 function convert_charset($str, $dest_charset) 1307 { 1308 if ($dest_charset=='utf-8') 1309 { 1307 function convert_charset($str, $source_charset, $dest_charset) 1308 { 1309 if ($source_charset==$dest_charset) 1310 1310 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') 1313 1316 { 1314 1317 return utf8_decode($str); … … 1316 1319 if (function_exists('iconv')) 1317 1320 { 1318 return iconv( 'utf-8', $dest_charset, $str);1321 return iconv($source_charset, $dest_charset, $str); 1319 1322 } 1320 1323 if (function_exists('mb_convert_encoding')) 1321 1324 { 1322 return mb_convert_encoding( $str, $dest_charset, 'utf-8');1325 return mb_convert_encoding( $str, $dest_charset, $source_charset ); 1323 1326 } 1324 1327 return $str; //??? … … 1537 1540 { 1538 1541 global $conf; 1539 1542 1540 1543 $options = array(); 1541 1544 foreach (array_reverse($conf['available_permission_levels']) as $level) 1542 1545 { 1543 1546 $label = null; 1544 1547 1545 1548 if (0 == $level) 1546 1549 { … … 1567 1570 ); 1568 1571 } 1569 1572 1570 1573 $label = implode(', ', $labels); 1571 1574 }
Note: See TracChangeset
for help on using the changeset viewer.