I'm trying to build a story in French, but every time I build the story, my accent a replace by strange characters.
ex: become
I think it's an encoding problem, but I don't know how to fix it.
My only solution now is to replace every character in the final html file...
is there an easier way to fix it?
Thank you!
Comments
internet explorer and chrome
I assume you're using Twine 1.4 or higher?
my compluter seems to decode those strange character correcly
it's when I upload the html file to my web site that it does not work...
the HTML code looks like this
<div id="storeArea"><div tiddler="test" tags="" modified="201401220838" created="201401220830" twine-position="307,22" modifier="twee">\n\n\n\n\no\n\n\n[img[test 2]]</div>
http://www.obsidia.ca/test.html
on my computer, the HTML File looks like this:
<div id="storeArea"><div tiddler="test" tags="" modified="201401220838" created="201401220830" twine-position="307,22" modifier="twee">\n\n\n\n\no\n\n\n[img[test 2]]</div>
Ah, the web server being involved explains it. The problem is in the encoding: the HTML contains Unicode characters in UTF-8, while your web server serves the HTML file using "Content-Type: text/html; charset=ISO-8859-1".
One solution would be to use entities (é etc or numeric) for all non-ASCII characters. Probably not the best way, since Unicode characters can occur in passages, in scripts, in style sheets etc and entities might need different syntax depending on the context.
Another solution would be to add a line like this to the <head> section of the HTML: There is already this line, but it doesn't seem to do anything: (in some browsers?)
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - same problem
I also try with those to match what I have on my other pages of the site - same issue.
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta http-equiv="Content-Language" content="fr-ca">
I think that the core of the problem is when I build my story the character are replace..
If I load your HTML file from the web server directly (when it is served as ISO-8859-1), the accented characters are wrong, but if I save it to a local directory and then load it from there, it displays fine. Therefore, the way the web server sends the file (what it puts in the HTTP headers) is what triggers the problem.
I would have thought the http-equiv header would solve it though.
I remember this on the Google group once - when Dropbox serves a file via HTTP it looks only at the first few bytes to determine the type. If the server detects HTML, it serves the HTML as ISO-8859-1 rather than reading far enough down the file to see the meta tag that would tell a regular web server to use UTF-8. Dropbox claims this is to protect the privacy of the file's contents.
There really isn't a viable workaround except to not serve the file via Dropbox (convenient as the service is for most purposes).
This page informed me that this is the valid way of specifying a charset in HTML5.
Anyway, I've found out that there is actually a solution: Dropbox will serve it with the correct encoding if the header files are saved with a byte-order mark, of all things. Dang!