質問

I would have expected that the page title respected the charset, but I'm seeing differently. Setting document.title to Fo'o Bar doesn't result in Fo'o Bar being printed as the page title. My browser encoding is set to UTF-8, I am declaring the charset in a meta tag, and the file is saved as UTF-8. It seems like my only option is to use JavaScript to create a DOM node and then set the document.title to the text from that node. Is this right?

役に立ちましたか?

解決

Set your title like this:

document.title = 'Fo\u0027o Bar';

See the MDN for full documentation on escaping Unicode characters.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top