Stylesheet taken-over/replaced by Chinese characters

前端 未结 3 458
失恋的感觉
失恋的感觉 2020-12-04 01:17

Okay, something just went crazy. Unless China is taking over starting with my test style.css file on my iepage - well I guess they are starting off on the right foot hating

3条回答
  •  醉梦人生
    2020-12-04 01:59

    I encountered this same problem with XML files exported from PowerShell that were embedded in iFrames.

    There was no issue in IE10/11 or Edge, but Firefox and Chrome wouldn't load the stylesheet.

    The original page loading the iFrames was UTF8 encoded, same with the stylesheet. However, the XML file was exported to UTF16LE ("Unicode" in PowerShell). When the XML file was loaded from the iFrame, it loaded the stylesheet as Chinese characters.

    I converted the encoding in PowerShell...

    Get-Content C:\foldername\file.html -Encoding Unicode | Set-Content -Encoding UTF8 C:\foldername\file.html
    

    ...and it worked! My guess is that IE must treat the encoding of all files the same as the parent, which meant that the UTF16LE encoded file was rendered as UTF8. Chrome and Firefox apparently don't do that.

    Thanks Xavier Holt for setting me on the right path!

提交回复
热议问题