Hi,
In include/functions_metadata.inc.php we assume that if we find non ASCII characters and if string doesn't qualify as UTF-8 then we apply a iso-8859-1 to utf-8 conversion.
A user has reported a problem with symbol "oe" (as a single character, ie "ligature") : the string is not displayed in Piwigo, but still exists (as an invisible character).
I have tried to replace iso-8859-1 by windows-1252 in function clean_iptc_value and it works fine on this photo. Then I wondered if you could detect Windows-1252 or ISO-8859-1 but it doesn't work with mb_detect_encoding. Then I read on http://stackoverflow.com/questions/3714 … 1-to-utf-8 :
[difference between Windows-1252 and ISO-8859-1] The characters 0x80-0x9F will not convert correctly. But these are control characters which are almost never used.
That means that if you use windows-1252 as origin encoding for conversion instead of iso-8859-1 it should be good for both windows-1252 and iso-8859-1 strings.
Do you think it's OK for changing:
[pierrick@pierrick-desktop] ~/public_html/piwigo/dev/branches/2.5
$ svn diff include/
Index: include/functions_metadata.inc.php
===================================================================
--- include/functions_metadata.inc.php (revision 23497)
+++ include/functions_metadata.inc.php (working copy)
@@ -103,7 +103,7 @@
if ( ($qual = qualify_utf8($value)) != 0)
{// has non ascii chars
$value = convert_charset( $value,
- $qual>0 ? 'utf-8' : 'iso-8859-1',
+ $qual>0 ? 'utf-8' : 'windows-1252',
get_pwg_charset() );
}
}Offline
ok with the condition iconv or mb_convert_encoding functions exist ...
Offline
Hi rvelices,
rvelices wrote:
ok with the condition iconv or mb_convert_encoding functions exist ...
Can you be more explicit?
Offline
plg wrote:
Hi rvelices,
rvelices wrote:
ok with the condition iconv or mb_convert_encoding functions exist ...
Can you be more explicit?
Take a look at convert_charset function
if ($source_charset==$dest_charset)
return $str;
if ($source_charset=='iso-8859-1' and $dest_charset=='utf-8')
{
return utf8_encode($str);
}
if ($source_charset=='utf-8' and $dest_charset=='iso-8859-1')
{
return utf8_decode($str);
}
if (function_exists('iconv'))
{
return iconv($source_charset, $dest_charset, $str);
}
if (function_exists('mb_convert_encoding'))
{
return mb_convert_encoding( $str, $dest_charset, $source_charset );
}
return $str; //???Offline
OK, done [Subversion] r24967, thank you rvelices.
Offline
Hello!
I have last version of Piwigo, but I have a problem with encoding IPTC.
In attachment 2 files:
goog_iptc.jpg have data in UTF-8
bed_iptc.jpg have data in ASCII win1251
goog_iptc.jpg is showed normally in Piwigo, but bed_iptc.jpg is showed uncorrect
Offline
hello
check the metadata using tool/metadata.php and report us in new thread Thx
Offline