PHP Escape HTML Characters

I am playing with the K2 word-press theme and I can’t get the wp_list_pages() in word-press to escape it’s html.

here is what I’m trying to do.

<?php htmlentities(wp_list_pages(), ENT_QUOTES); ?>

if you look at the page source at at line 125 you will see that the last var in the flashVar is not escaping the html and the quotes are braking the string.