From 13f8a0dd7baf07ebddc72c1764b5ab13f3c9f42c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 5 May 2009 03:30:49 +0000 Subject: Detect input encodings from EXIF/IPTC data and convert to utf-8 as appropriate. This allows us to switch the exif value column back to varchar and improves the way that we deal with non-utf8 data in our embedded EXIF/IPTC data. --- modules/tag/helpers/tag_event.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules/tag/helpers') diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index a301c441..a4a6ec26 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -34,7 +34,10 @@ class tag_event_Core { if (!empty($iptc["2#025"])) { foreach($iptc["2#025"] as $tag) { $tag = str_replace("\0", "", $tag); - $tags[$tag]= 1; + if (mb_detect_encoding($tag) != "UTF-8") { + $tag = utf8_encode($tag); + } + $tags[$tag] = 1; } } } -- cgit v1.2.3