문제

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