To make it better:
1. use a cffunction tag. In this specific case it might not
make much difference, but it's a good habit to adopt as the
cfargument tag is pretty useful.
2. This is wrong
var xvali = ReReplace(info,"<P>","<p>","all");
because there is no variable in your function called info.
3. Your function would be easier to maintain (add more
substutions) if you start with two lists and do a loop.
something like this
var mystring = arguments.texttoxhtml;
var goodlist = "<p>,</p>,<b>,</b>";
var badlist =
"<P>,</P>,<STRONG>,</STRONG>";
var i = 1;
var listitems = ListLen(GoodList);
for (i = 1; i lte ListItems; i = i + 1) {
MyString = Replace(MyString, ListGetAt(BadList, i),
ListGetAt(GoodList, i), "all");
}
</cfscript>
<cfreturn MyString>
}
That's the general idea. If I got anything wrong, you can fix
it.