Replacing umlauts in JS
===

I am comparing strings and have to replace umlauts in JS, but it seems JS does not recognize the umlauts in the strings. The text comes from the database and in the browser the umlauts do show fine.

    function replaceUmlauts(string)
    {
        value = string.toLowerCase();
        value = value.replace(/ä/g, 'ae');
        value = value.replace(/ö/g, 'oe');
        value = value.replace(/ü/g, 'ue');
        return value;
    }

As search patterns I tried:

- "ä", "ö", "ü"
- /ä/, /ö/, /ü/
- "`&auml;`", "`&ouml;`", "`&uuml;`" (well total despair ;-))

To be sure, that it is not a matter with the replace function I tried indexOf:

    console.log(value.indexOf('ä'));
But the output with all patterns is: `-1`

So I guess it is some kind of a problem with encoding, but as I said on the page the umlauts do just look fine.

Any ideas? This seems so simple...