Closed inillaug closed 4 years ago
Hi,
It appears that you are on windows, and you was using a non-utf8 editor, like notepad ... no ?
Sorry for that, but currently, html's content can only be utf8 (and no windows-1252 or consorts) ...
Try the same thing, with a ut8's ready editor (set the file's encoding to utf8) .. and tell me
Hello manatlan, the html file is already in UTF-8. I've opened it with "Notepad++" in Windows7. The head content is already meta-tagged as UTF-8.
meta http-equiv="Content-Type" content="text/html; charset=utf-8" meta charset="UTF-8"
could you post me your html file ? to have a look
I've understand ;-) You've setted your meta tag as if it was utf8 ... But, on windows, default encoding is "mbcs" (cp-1252 in europe) : so your content is windows-1252 ! try to set your meta as "Windows-1252" .. and it should work (or configure your notepad++ to encode your text content as utf8). In fact : your meta tag should be the same as the content encoding (if it differs, like you, you encounter this kind of troubble)
I close ... feel free to reopen if not
Hello, No way. If I open the html file directly in Firefox, the viewing is correct. If I open the html file trough guy -> Firefox, the wiewing is wrong.
Hi, glad to hear you again ...
Can you provide a version of your HTML file, so I could see the trouble, and could fix it ?
Hi, how can I send you the file?
you can attach a file ... here in a comment !
below the code....
`<!DOCTYPE html>
Questa è la nostra prima pagina HTML!
`
can your repost a comment, with the file embedded in the msg (by just dragging it from your file folder to the comment in your browser) ?
(because, with copying/pasting like this, there are a (lot of) treatment on the content, which will corrupt/correct the content)
Here the file...
thanks ...
Your file is well encoded (content is really utf8, and declared as utf8) It works like expected ...
here is my test
#!/usr/bin/python
# -*- coding: utf-8 -*-
import guy
class Simple(guy.Guy):
pass
if __name__ == "__main__":
Simple().run()
what's the trouble ? (which python version ? which os ?) test.zip
Above my result with your python test code. The OS is WIN7 64bit Python is 3.6.8 64bit
Strange ... and your chrome version ? (mine : Version 80.0.3987.87)
Google Chrome Version 80.0.3987.132
In the real world, your browser should see that the page is UT8 (according the meta declaration), and display it as ... UTF8. But in your case: it's clearly display it, as "Windows-1252" ... so it shows "è" instead of "è".
I don't think it could be a windows trouble (not a py trouble too).
The only thing: perhaps have you forced your Chrome to display all pages as "Windows-1252" ... BTW, i don't find how to set this in current chrome settings (it seems that the easy option has been removed) ... or perhaps you have a chrome extension which override defaults ?!?
I will think/search about it .. and come back later with an idea ;-)
If I run the code in "server mode" and I open the webpage in firefox or IE the trouble is the same. If I open the file "Simple.html" directly in firefox, IE, chrome the webpage is rendered correctly without trouble. Anyway I'll test your suggestion.
and if you visit : https://a-starlette.glitch.me/spe what do you see ?
you should see:
I saw exactly wath you saw.
So, it can't be a trouble in your browser.
Run my test ^^, in server mode, and try to point your browser to your real IP --> http://
I already did this test. If I run the code in "server mode" and I open the webpage in firefox, IE, chrome the trouble is the same.
I did all test executed before in win7 on a win10 machine with the same trouble.
on monday, I will have access to a win10/py3.7+latest chrome ... I will have a test ... but if this was really a bug I'd already seen it
I tested with win10/py3.7 and the trouble is the same. "Simple.html" loaded with apache shows correctly.
The same code of Simple.html put in doc string works correctly. See the attached py file.
The trouble is in parsing the file to string. See this code....
ok thanks @inillaug ! You have found the trouble ! It's my fault ... I thought that py3 known how to read a text file on "non-utf8" file system. I apply a patch soon
Please try the newest release : https://pypi.org/project/guy/0.5.4/ it should fix this issue
thanks a lot for your work !!!
Version 0.5.4 fixed the issue. thanks a lot for your help!!
Hello,
I put in
but the character "è" appear as "è". If open the html without loading webserver the character "è" is correct.