views:

28

answers:

3

Hi,

I am trying to update the document.title with Javascript. This works fine, but now I want to insert the ü character into the title, which gives me a question mark at the place where the ü is supposed to be.

Here is my code (I omitted the rest of the title for clarity):

document.title = '\u2019 - \u252';

The strange thing is that the \u2019 part does work and gives me a quote, as expected. My charset is UTF-8, by the way.

What am I doing wrong here?

+1  A: 

What's \u252? It doesn't seem to be a valid unicode escape, try \u0252?

SHiNKiROU
I tried \u252 because I thought of ü.\u0252 gives me a ɒ character, which doesn't seem right either..
Evert
A: 

Update: Apologies. I read it wrong. Thought you were looking for "ɒ" which is the result I get...

This worked for me on Chrome, Firefox and Safari (OSX)

document.title = '\u0252';
michael
+1  A: 

Do you want document.title = '\u00FC'; ? the &# and \u numbers are different in many places, or so i've found in my usages.

Justin808
It works! Thanks mate!
Evert
@Evert: FYI, using the [Unicode Code Converter](http://rishida.net/tools/conversion/) you can easily convert those values yourself.
Marcel Korpel
@Marcel: Great tip!
Evert