Using node_presave to make value utf8 encoded

While using feeds, sometimes we need to convert data received from feeds to utf8 format. There were queries how we can do this, well there are modules available for that but if that is the only thing you want to do then simply use hook_presave like below.



In my case I had this problem for body field. So I used presave hook to convert string to utf8 for body field of that content type.

I was getting error below when I was importing posts from facebook.

So I have written function below in .module file of my custom module.

This worked fine!

Follow me

Sachin Wable

Sachin Wable is a technical blogger. He is blogging since 2010 & writes about Blogging, affiliate marketing & technical stuff. His blog learn-drupal.in receives 22,500 page views and visits from 1934 cities from 135 countries per year. (As per last years google analytics report.)
Follow me

Latest posts by Sachin Wable (see all)

Sharing is sexy...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
affiliate_link

333 views

Leave a Reply

Your email address will not be published. Required fields are marked *