2

I have been working with data received from Guzzle and it is producing a Unicode String that looks similar to this Bachelor\u2019s Degree (after some parsing). When I save other content within craft through craft()->entries->saveEntry( $entry ) The unicode items are converted to their appropriate characters. However, when I use this in the ElementCriteriaModel searches, it does not work because it is using the literal Bachelor\u2019s Degree. It does work when I hard code Bachelor's Degree so the lookup code is functional. Also, I tried all of the StringHelper static functions and have done tons of iterations of mb_convert_encoding( 'Bachelor\u2019s Degree', 'HTML-ENTITIES', 'utf-8' ), htmlspecialchars, and htmlentities, but it has not produced a good result. Here is the code I am using for the query just in case:

$criteria = craft()->elements->getCriteria( ElementType::Category );
$criteria->title = $job[ 'eduReq' ];
$eduReq = $criteria->first();

Do you all know how to convert this string correctly so that the ElementCriteriaModel uses Bachelor's Degree?

2

Could this maybe be a unicode issue? Maybe the api plugin is producing \u2019 instead of the unicode to produce a normal '

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.