Instead of directly setting the click event through html, bind an event listener. eval(f) allows you to refer to functions by a string. If possible, I recommend passing a direct reference to the function.
If the function is defined in the global scope, use window[f]. Note: This won't work if f looks like Math.round, because window["Math.round"] != window["Math"]["round"].
//f is a string which contains a single function name.
var b = $('<button>').click(function(){
eval(f)(encodedString);
});
$('li').append(b);
If f is a dynamic variable, which changes (eg, in a loop), wrap the code in an anonymous function:
(function(f){
var b = $('<button>').click(function(){
f(encodedString);
});
$('li').append(b);
})(eval(f));