Dynamically insert a special character in the document title

I am trying to update document.title using Javascript. This works great, but now I want to insert the ü symbol in the heading, which gives me a question mark in the place where ü is supposed to be.

Here is my code (I skipped the rest of the header for clarity):

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

The strange thing is that part \ u2019 really works and gives me a quote, as expected. By the way, my encoding is UTF-8.

What am I doing wrong here?

+3
source share
3 answers

Do you want to document.title = '\u00FC';? the numbers & # and \ u differ in many places, or so I found in my customs.

+1
source

? , escape- unicode, \u0252?

+1

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

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

document.title = '\u0252';
0
source

Source: https://habr.com/ru/post/1762069/


All Articles