just did a quick and dirty test and it worked for me... not sure if it will do the job for all sorts of utf8 strings though... but I think it would be a good start... 

@stood could you add this check and convert to utf8 only if necessary?