{"action":"created","issue":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/832","labels_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/832/labels{/name}","comments_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/832/comments","events_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/832/events","html_url":"https://github.com/mishoo/UglifyJS2/pull/832","id":111563733,"number":832,"title":"Fix escapes in dictionary keys. Place source token in sourceMap ","user":{"login":"startswithaj","id":3658522,"avatar_url":"https://avatars.githubusercontent.com/u/3658522?v=3","gravatar_id":"","url":"https://api.github.com/users/startswithaj","html_url":"https://github.com/startswithaj","followers_url":"https://api.github.com/users/startswithaj/followers","following_url":"https://api.github.com/users/startswithaj/following{/other_user}","gists_url":"https://api.github.com/users/startswithaj/gists{/gist_id}","starred_url":"https://api.github.com/users/startswithaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/startswithaj/subscriptions","organizations_url":"https://api.github.com/users/startswithaj/orgs","repos_url":"https://api.github.com/users/startswithaj/repos","events_url":"https://api.github.com/users/startswithaj/events{/privacy}","received_events_url":"https://api.github.com/users/startswithaj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-15T07:55:14Z","updated_at":"2015-10-16T02:52:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/pulls/832","html_url":"https://github.com/mishoo/UglifyJS2/pull/832","diff_url":"https://github.com/mishoo/UglifyJS2/pull/832.diff","patch_url":"https://github.com/mishoo/UglifyJS2/pull/832.patch"},"body":"This will fix dict keys like the ones in lodash:\r\n\r\n  var deburredLetters = {\r\n    '\\xc0': 'A',  '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\r\n    '\\xe0': 'a',  '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\r\n    '\\xc7': 'C',  '\\xe7': 'c',\r\n    '\\xd0': 'D',  '\\xf0': 'd',\r\n    '\\xc8': 'E',  '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\r\n    '\\xe8': 'e',  '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\r\n    '\\xcc': 'I',  '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\r\n    '\\xec': 'i',  '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\r\n    '\\xd1': 'N',  '\\xf1': 'n',\r\n    '\\xd2': 'O',  '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\r\n    '\\xf2': 'o',  '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\r\n    '\\xd9': 'U',  '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\r\n    '\\xf9': 'u',  '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\r\n    '\\xdd': 'Y',  '\\xfd': 'y', '\\xff': 'y',\r\n    '\\xc6': 'Ae', '\\xe6': 'ae',\r\n    '\\xde': 'Th', '\\xfe': 'th',\r\n    '\\xdf': 'ss'\r\n  };\r\n\r\nThe keys are read in and converted to their actual character representation by the AST but not escaped back when they are placed in the sourcemap. This means that À gets inserted into the sourcemap when in reality the key is \\xc0.\r\n\r\nSo its looking to map À at whatever offset it can only find '\\xc0' in the source. And usually its trying to match 1 character so it attempts to to match À == '.\r\n\r\nÀ should never get into the sourcemap because its not in the source.\r\n\r\n@malloc might be able to add to this as he came up with the solution.\r\n\r\nSolves #341 as well\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/comments/148583652","html_url":"https://github.com/mishoo/UglifyJS2/pull/832#issuecomment-148583652","issue_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/832","id":148583652,"user":{"login":"kzc","id":11593452,"avatar_url":"https://avatars.githubusercontent.com/u/11593452?v=3","gravatar_id":"","url":"https://api.github.com/users/kzc","html_url":"https://github.com/kzc","followers_url":"https://api.github.com/users/kzc/followers","following_url":"https://api.github.com/users/kzc/following{/other_user}","gists_url":"https://api.github.com/users/kzc/gists{/gist_id}","starred_url":"https://api.github.com/users/kzc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzc/subscriptions","organizations_url":"https://api.github.com/users/kzc/orgs","repos_url":"https://api.github.com/users/kzc/repos","events_url":"https://api.github.com/users/kzc/events{/privacy}","received_events_url":"https://api.github.com/users/kzc/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T02:52:14Z","updated_at":"2015-10-16T02:52:14Z","body":"The back end has to work with a few parsers. I don't think this pull request would work with `--acorn` or `--spidermonkey`. The code should still work in the absence of this new source property."}}