#8 result.html generates with wrong unicode

开启中
Tarry_Dan1 年之前创建 · 1 条评论

Error:

  1. I run the code. It generates result.html (and iirc, the first time...it displays with the stylesheet)

  2. I run it again. The website is now not displaying any styles. Looking at View Source, I can click the link to the stylesheet and correctly open it. The path is correct. But they don't display. The inspect tool shows no styles present.

  3. If I copy the html from results.html into a new file, and open that - the page displays correctly. As it should: the css is correct, and so is the link in the html.

  4. But for some reason, no future version of results.html shows styles.

  5. When I open results.html in notepad, and save it - it automatically gives the option to save the encoding as 'Unicode', presumably because that's what it detects. When I change that to 'UTF-8', the problem is now solved. Opening results.html in the browser displays my custom css.

I am using Windows PowerShell to run my code - I'm unsure if it's a PowerShell behavior I need to fix, or if there's something at your end you can set to ensure it always exports the results.html file in UTF-8 correctly.

Cheers!

Error: 1. I run the code. It generates result.html (and iirc, the first time...it displays with the stylesheet) 2. I run it again. The website is now not displaying any styles. Looking at View Source, I can click the link to the stylesheet and correctly open it. The path is correct. But they don't display. The inspect tool shows no styles present. 3. If I copy the html from results.html into a new file, and open that - the page displays correctly. As it should: the css is correct, and so is the link in the html. 4. But for some reason, no future version of results.html shows styles. 5. When I open results.html in notepad, and save it - it automatically gives the option to save the encoding as 'Unicode', presumably because that's what it detects. When I change that to 'UTF-8', the problem is now solved. Opening results.html in the browser displays my custom css. I am using Windows PowerShell to run my code - I'm unsure if it's a PowerShell behavior I need to fix, or if there's something at your end you can set to ensure it always exports the results.html file in UTF-8 correctly. Cheers!
likho 评论于 1 年之前
所有者

Hi. Thanks for the feedback.

I run the script and therefore the python interpreter on Linux. My python install and terminal emulator are generic. The example Makefile is also pretty close to how I run the script.

The only logic relating to unicode is recognizing blank character in content.txt if the user wants to break a tag e.g #fanfic|tion. But this shouldn't be the cause.

My first guesses are

  1. Windows handling line breaks differently from Linux.

  2. the application you are using to preview the result is caching the page

  3. you have two result.html, but one of which is updated by the script while the other is not

If 3 is the case, you could add a line to your .sh, .bat, or Makefile to e.g cp pc/result.html webserver/result.html

Hi. Thanks for the feedback. I run the script and therefore the python interpreter on Linux. My python install and terminal emulator are generic. The example Makefile is also pretty close to how I run the script. The only logic relating to unicode is recognizing blank character in content.txt if the user wants to break a tag e.g #fanfic|tion. But this shouldn't be the cause. My first guesses are 1. Windows handling line breaks differently from Linux. 2. the application you are using to preview the result is caching the page 3. you have two result.html, but one of which is updated by the script while the other is not If 3 is the case, you could add a line to your .sh, .bat, or Makefile to e.g `cp pc/result.html webserver/result.html`
登录 并参与到对话中。
未选择标签
未选择里程碑
未指派成员
2 名参与者
正在加载...
取消
保存
这个人很懒,什么都没留下。