Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

XMP keywords in Unicode doesn't not show
https://www.tinywebgallery.com/forum/viewtopic.php?f=5&t=3750
Page 1 of 1

Author:  pumin [ 23. Oct 2014, 04:32 ]
Post subject:  XMP keywords in Unicode doesn't not show

Hello,

When I put unicode XMP keyword (embedded in photo) in other languages, eg. Thai language, it will not show under Info->Image Tags, and will not be searchable. To my understanding TWG uses function utf8_encode and that ignores all symbols and characters from other languages.

I went ahead and did a temporary hack that fixes the issue. Hopefully this can be refined by TWG and to allow unicode tags into next release.

Best Regards,
Pumin

inc/readxml.inc.php

line# 1328 change
Code:
//$retArray["image"] = ($iptc_encoding == 'utf-8') ? $retArray["image"] : utf8_encode($retArray["image"]);
$retArray["image"] = ($iptc_encoding == 'utf-8') ? $retArray["image"] : myUrlEncode($retArray["image"]);


line# 1457
Code:
//$xml_string = "<BILD><NAME>" . urlencode($image) . "</NAME><WERT>" . UrlEncode($tags_image) . "</WERT></BILD>\n";
$xml_string = "<BILD><NAME>" . urlencode($image) . "</NAME><WERT>" . $tags_image . "</WERT></BILD>\n";


Code:
function myUrlEncode($string) {
// credit to davis.peixoto
$entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
$replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]");
return str_replace($entities, $replacements, $string);
}

Author:  TinyWebGallery [ 23. Oct 2014, 09:26 ]
Post subject:  Re: XMP keywords in Unicode doesn't not show

Does setting
$iptc_encoding = 'utf-8';

in the config not simply solve you problem?

Best, Michael

Author:  pumin [ 28. Oct 2014, 14:40 ]
Post subject:  Re: XMP keywords in Unicode doesn't not show

Please disregard the hack.

Now TWG works normal without hack, and with both $iptc_encoding = ''; and = 'utf-8';

Not sure what I did to my server, TWG just works great! :roll:

Thanks Mike!

Author:  TinyWebGallery [ 28. Oct 2014, 14:53 ]
Post subject:  Re: XMP keywords in Unicode doesn't not show

;). Feel free to recommend it.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/