MS Office hyperlinks change code page?

2019-08-23 11:50发布

When you paste the following URL into IE: http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx, the link on the right of the page cleanly says "Download Zoomit (77 KB)". If you paste the link into an Office document (Word, Excel, PowerPoint -- tested using Office 2003), and activate the link from the document, that same text has picked up a couple of A-circumflex symbols. This is because the source HTML contains " " entities (non-breaking space) which get translated to Unicode 00A0. In UTF-8, this is expressed as X'C2A0', and then the X'C2' gets displayed as a A-circumflex. I don't completely understand how the code pages get mixed up like this, but I'd really like to find a HTML meta http-equiv charset value that will cause my pages containing the nbsp-entity to display properly even when linked from an Office document.

1条回答
放我归山
2楼-- · 2019-08-23 12:34

I found an answer that seems to be working. First I added an alert to display the document.charset. This displayed "utf-8" when invoked directly, and "windows-1252" when invoked from a hyperlink in a MS Office document. I therefore inserted the following meta-tag, and pages seem to display correctly even when invoked from Office documents:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
查看更多
登录 后发表回答