Archive for May 24, 2016

Using node_presave to make value utf8 encoded

Share

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!

Sharing is cool...Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
872 views