Unsafe Characters error message. #901

manngo opened this Issue Mar 7, 2013 · 8 comments


None yet
6 participants

manngo commented Mar 7, 2013

JSHint warns me about unsafe characters when I include unicode characters, such as the “smart” quotes. For example:

var a='This is a string with “smart” quotes';
alert(a); // string includes “smart” quotes

The message I get is:

This character may get silently deleted by one or more browsers.

I am using Komodo Edit 7.1.3 on Macintosh OSX 10.8; the version of jshint is 1.1.0 manually installed.

Because the page is encoded in utf-8, these (and many other) characters should be perfectly safe, and no browser, even Internet Exterminator, has a hard time with them.



I get this issue with some other Unicode characters too, even when I have the environment set to Node. Technically, I'm not even outputting to any browser so this message is even more annoying!

manngo commented May 10, 2013

For now I have disabled the test by finding and commenting out the following lines:

// at = s.search(cx);

// if (at >= 0)
// warningAt("Unsafe character.", line, at);

cx is a variable which contains a regex of “unsafe” characters. It should be possible to simply remove the safe characters from the list, but I can’t see where the unicode quote charquote characters are in the list in the first place …

kuleszaj added a commit to kuleszaj/jshint that referenced this issue Jun 7, 2013

Add a relaxing option to disable the unsafeChars check (W100)
This patch modifies the check for unsafe characters (unsafeChars) by
providing an option to relax it (option.unsafechars).

Several of the characters in the "unsafeChar" list are legitimate
Unicode characters (such as characters for the Sinahala language), and
can work properly if expected.

By default, this patch has no effect. It only causes a change in
behavior if the 'unsafechars' option is set to true.

References: GH-901

valueof commented Dec 28, 2013

This was fixed.

@valueof valueof closed this Dec 28, 2013

it's not working any more. and the option "unsafechars" don't even exist in current code!
Check please: kuleszaj/jshint@fc322f4

so we get the same errors again for smart quotes and some valid UTF-8 chars also.

$(document).ready(function() { /* когда документ полностью готов - начинаем работать... */
the char "л" is absolutely legal for all UTF-8 browsers, i don't understand why jshint thinks it can be silently deleted. it's just one of usual Cyrillic letters - nothing to worry about.
and i get the same errors for some other Cyrillic letters.

and anyway - it's just comments! :))) it's not browser-sensitive strings.

I'm on version 2.5.1 and still receiving this
Error Reason
This character may get silently deleted by one or more browsers.
Error Evidence
(function (nm, params) {

It passed now after I trimed the code I was passing to jshint

jshint( code.trim(), null, jshintConfig )

bigfish commented Jan 20, 2015

/jshint -W100/

works to supress this error, in 2.5.8, whereas 'unsafechars' is flagged as a 'bad option'

bigfish commented Jan 20, 2015

that should have read

    /*jshint -W100*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment