views:

25

answers:

2

Hi.

I wrote a small snippet in jQuery to just put a search word into my searchbox in wordpress, then when clicked to disappear.

<script type="text/javascript">
            var $j = jQuery.noConflict();

            $j(function(){
                $j('#s').click(function() {
                    $j(this).val('');
                });

                var search = "Sök på sajten...";

                $j('#s').val(search);
            });
        </script>

currently when I get to the site it looks like this. S�k p� sajten...

What has to be changed?

+1  A: 

ensure you are using the utf-8 charset

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

if this is the case, you can try encoding the characters( å = & #229; (minus the space)), and see if that gets you anywhere.

Orbit
+1  A: 

A quick/dirty way to cope with these issues when you're dealing with hardcoded strings is to unicode escape your JS (ö = \u00f6 in your case).

However, Brandon's suggestion above is the recommended approach - note that the meta tag isn't enough, you must make sure that the file (or rather, the content ultimately served to the client) actually IS utf-8 encoded.

Gustav Carlson