Folks –
In Dreamweaver I have a Command that searches through the page and replaces all foreign letters with their proper code [for example, a ‘u’ with umlauts becomes ü]:
function canAcceptCommand(){return true;}
function convertForeignText() {
var theDOM = dw.getDocumentDOM();
var theDocEl = theDOM.documentElement;
var theWholeDoc = theDocEl.outerHTML;
theDocEl.outerHTML = escapeExtended(theWholeDoc);
window.close();
}
function escapeExtended(s){
return s.replace(/([x80-uffff])/g, function (a, b) {
var c = b.charCodeAt();
return “&#” +c+”;”
});
}
What I’d like to have is another Dreamweaver command that will do the same, except it will replace all instances of a string with another string, so for example all strings equal to “Hello world” would be replaced with “Hello world”, and all “Good Night” would be replaced by “good night”, etc etc
Presumably it will need an array which can contain all of the strings to look for and all of their replacements, but beyond that I don’t know what to do! Anyone got a bit of javascript to do this?