Perhaps this function and stringframe_chars could be merged? If it's just the '%' character that is different doesn't make much sense to have the code twice.