Yii Framework Forum: htmlspecialchars(): Invalid multibyte sequence in argument - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

htmlspecialchars(): Invalid multibyte sequence in argument Php error resolution Rate Topic: ***** 1 Votes

#1 User is offline   ibecake 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 13-October 11
  • Location:Ireland

Posted 10 February 2012 - 06:43 AM

Hi just a quick tip for us noobies.
If you get this error,
htmlspecialchars(): Invalid multibyte sequence in argument
There are 3 things that helped me.
1. Make sure you file is saved in UTF-8 most decent editors will give you this option.
2. Make sure your Database table is saved UTF-8 as well.
3. Finally and this is where i tripped myself up for a day is trying to display the field in a view so remove the field from the View attributes and the page will render correctly for you. To display the file you need to follow this tutorial.
Inserting a Blob into a database.
Just something that might help someone else.
Thanks
Ibecake
Ibecake
Jack of all trades master of none..yet
1

#2 User is offline   Gerasimos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-September 12

Posted 02 October 2012 - 04:13 PM

Thank you!!
0

#3 User is offline   Binc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 11-January 12

Posted 16 December 2013 - 05:12 PM

The use of substr instead of mb_substr tripped me into this error. In short: if you use UTF-8, use mb_substr.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users