You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-utf8 encoding of internal client-side JavaScript files? #678
All of my js source files (browser and web) are encoded using utf-8 (without BOM). However, I happen to experience the following issue.
When I use "special characters" in my web JavaScript files, they are somehow converted to another encoding. For example, printing ä to the console (DevTools) using console.log produces garbage. Right now, I'm getting around this problem by using the escaped versions of all special characters.
See this example program to illustrate the problem:
So, the ä send via ipc from node is encoded correctly, but the ä from index.html is garbled. Note that index.html is utf-8 encoded. It actually makes no difference, if I include the js code from a separate file.
@zcbenz That seems weird to me. I couldn't reproduce this behavior using different versions of Chrome on Windows.
Windows 7 SP1, Chrome Version 39.0.2171.52 beta-m
Windows 10 (Build 9860), Chrome Version 38.0.2125.111 m
@kostia Thanks, I just tested this with the current version v0.33.3 (ia32) on Windows. Explicitly setting the encoding to UTF-8 resolves all problems for inline scrips and referenced scripts. 👍
I thought, somehow, chromium would figure out the encoding automatically or at least default to UTF-8. None of it is the case. It seems to default to another charset. On a German Windows 8.1 it seems to be Windows-1252.
Activity
zcbenz commentedon Nov 7, 2014
As I tested in Chrome 38,
console.log('ä')printedäin console too, you should report this bug to Chromium project.MartinMa commentedon Nov 7, 2014
@zcbenz That seems weird to me. I couldn't reproduce this behavior using different versions of Chrome on Windows.
Windows 7 SP1, Chrome Version 39.0.2171.52 beta-m
Windows 10 (Build 9860), Chrome Version 38.0.2125.111 m
zcbenz commentedon Nov 7, 2014
You need to write
console.log('ä')in HTML file to reproduce, executing it under devtools works in atom-shell too.kostia commentedon Sep 22, 2015
I have the same issue with Version 0.33.1 on OSX 10.10.5:
will produce
zcbenz commentedon Sep 23, 2015
To show HTML pages that don't use UTF-8 encoding, you should explicitly set page's encoding like this:
kostia commentedon Sep 23, 2015
Thanks @zcbenz, that worked for me!
However, "ä" is UTF-8 (http://www.utf8-zeichentabelle.de). I somehow assumed, that a document with an HTML5 doctype would have UTF-8 charset by-default. But it does not. Should the Quick-Start example include the right charset? https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md
@MartinMa Does setting the correct encoding resolve your problem?
zcbenz commentedon Sep 23, 2015
I think we should, you can send a pull request for that.
📝 Include UTF-8 charset in quick start example
MartinMa commentedon Sep 30, 2015
@kostia Thanks, I just tested this with the current version v0.33.3 (ia32) on Windows. Explicitly setting the encoding to UTF-8 resolves all problems for inline scrips and referenced scripts. 👍
I thought, somehow, chromium would figure out the encoding automatically or at least default to UTF-8. None of it is the case. It seems to default to another charset. On a German Windows 8.1 it seems to be Windows-1252.