Ignore:
Timestamp:
Oct 17, 2013, 10:11:45 PM (11 years ago)
Author:
plg
Message:

bug 2973 fixed: automatically use encoding windows-1252 instead of iso-8859-1
(unless we find utf-8 signs) on IPTC before converting to utf-8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/include/functions_metadata.inc.php

    r22660 r24967  
    103103    if ( ($qual = qualify_utf8($value)) != 0)
    104104    {// has non ascii chars
    105       $value = convert_charset( $value,
    106         $qual>0 ? 'utf-8' : 'iso-8859-1',
    107         get_pwg_charset() );
     105      if ($qual>0)
     106      {
     107        $input_encoding = 'utf-8';
     108      }
     109      else
     110      {
     111        $input_encoding = 'iso-8859-1';
     112        if (function_exists('iconv') or function_exists('mb_convert_encoding'))
     113        {
     114          // using windows-1252 because it supports additional characters
     115          // such as "oe" in a single character (ligature). About the
     116          // difference between Windows-1252 and ISO-8859-1: the characters
     117          // 0x80-0x9F will not convert correctly. But these are control
     118          // characters which are almost never used.
     119          $input_encoding = 'windows-1252';
     120        }
     121      }
     122     
     123      $value = convert_charset($value, $input_encoding, get_pwg_charset());
    108124    }
    109125  }
Note: See TracChangeset for help on using the changeset viewer.