SIERRA Posted August 29, 2018 Share Posted August 29, 2018 Hi If we use chinese text in processwire find method like the below the error appears as 'Fatal error: Exception: Unknown Selector operator: ''' $title="谢师宴 11am-1pm, Test服务奖 service award"; $eventspage = $pages->get(1085); //eventspage $findeventspage=$eventspage->events->find("title={$title}"); Could you please suggest on this. Thanks Link to comment Share on other sites More sharing options...
Zeka Posted August 29, 2018 Share Posted August 29, 2018 @SIERRA Just put your text in quotes d($pages->find('title="谢师宴 11am-1pm, Test服务奖 service award"')); Link to comment Share on other sites More sharing options...
SIERRA Posted August 29, 2018 Author Share Posted August 29, 2018 Thanks for your reply if we give $title="School Resumes"; $eventspage = $pages->get(1085); //eventspage $findeventspage=$eventspage->events->find("title={$title}"); echo $findeventspage; this displays id if we give $title="School Resumes"; $eventspage = $pages->get(1085); //eventspage $findeventspage=$eventspage->events->find('title={$title}'); echo $findeventspage; this does not displays id if we give $title="谢师宴 11am-1pm, Test服务奖 service award"; $eventspage = $pages->get(1085); //eventspage $findeventspage=$eventspage->events->find('title={$title}'); echo $findeventspage; this also does not displays id. Actually we need to check the duplicates if availabe. Could you please suggest. Thanks Link to comment Share on other sites More sharing options...
Zeka Posted August 29, 2018 Share Posted August 29, 2018 $title="谢师宴 11am-1pm, Test服务奖 service award"; $eventspage = $pages->get(1085); //eventspage $findeventspage=$eventspage->events->find("title='$title'"); Try this Link to comment Share on other sites More sharing options...
SIERRA Posted August 29, 2018 Author Share Posted August 29, 2018 This also does not displays id Link to comment Share on other sites More sharing options...
BitPoet Posted August 29, 2018 Share Posted August 29, 2018 It is better to use $sanitizer->selectorValue() to get the value in the correct shape to be used in a selector than to add quotes yourself, though @Zeka's example works. $title="谢师宴 11am-1pm, Test服务奖 service award"; $eventspage = $pages->get(1085); //eventspage $selector = "title=" . $sanitizer->selectorValue($title); $findeventspage=$eventspage->events->findOne($selector); If a hand coded selector doesn't yield any results, it's always worth checking whether the PHP file is in the correct encoding (UTF-8). Access restrictions may also come into play, which can be easily checked by appending ", include=all" to the selector to ignore access checks. Link to comment Share on other sites More sharing options...
Zeka Posted August 29, 2018 Share Posted August 29, 2018 @BitPoet Before posting my answer I have made tests with and without using $sanitizer->selectorValue. In this exact case, the page wasn't found after sanitizing of the string "谢师宴 11am-1pm, Test服务奖 service award". Link to comment Share on other sites More sharing options...
SIERRA Posted August 30, 2018 Author Share Posted August 30, 2018 (edited) @BitPoet This is working. @BitPoet and @Zeka Thanks for your help Edited August 30, 2018 by SIERRA Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now