Answers.Body: <p>Could this maybe be a unicode issue? Maybe the api plugin is producing \u2019 instead of the unicode to produce a normal <code>'</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-02T17:55:05.320Z
Answers.LastActivityDate: 2016-12-02T17:55:05.320Z
Answers.UserDisplayName: jooosh
Body: <p>I have been working with data received from Guzzle and it is producing a Unicode String that looks similar to this <code>Bachelor\u2019s Degree</code> (after some parsing). When I save other content within craft through <code>craft()-&gt;entries-&gt;saveEntry( $entry )</code> 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 <code>Bachelor\u2019s Degree</code>. It does work when I hard code <code>Bachelor's Degree</code> so the lookup code is functional. Also, I tried all of the <code>StringHelper</code> static functions and have done tons of iterations of <code>mb_convert_encoding( 'Bachelor\u2019s Degree', 'HTML-ENTITIES', 'utf-8' )</code>, <code>htmlspecialchars</code>, and <code>htmlentities</code>, but it has not produced a good result. Here is the code I am using for the query just in case:</p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria( ElementType::Category );
  $criteria-&gt;title = $job[ 'eduReq' ];
  $eduReq = $criteria-&gt;first();
  </code></pre>
  
  <p>Do you all know how to convert this string correctly so that the ElementCriteriaModel uses <code>Bachelor's Degree</code>?</p>
  
Tags: <plugin-development><elementcriteriamodel>
Title: ElementCriteriaModel UTF-8 Encoding
ThreadText: # ElementCriteriaModel UTF-8 Encoding
  
  (Asked by: username_0 on 2016-12-02)
  
  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`?
  
  **Tags:** plugin-development, elementcriteriamodel
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-02. Score: 2 | Accepted answer
  
  Could this maybe be a unicode issue? Maybe the api plugin is producing \u2019 instead of the unicode to produce a normal `'`
  
  
  ---
  
  