Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.5
-
Fix Version/s: 4.7.9
-
Component/s: None
-
Labels:
-
Documentation Required?:None
-
Funding Source:Core Team Funds
Description
Error : SyntaxError: unterminated string literal on p = backend(entity, action, eval('('angular.toJson(params)')'), message);
I hit the issue on a customer site when I tried to use an existing civimail template in their database. After some digging I found that the message template contained the hex character E280A8
Perhaps significantly this is a multibyte char. Probably a windows soft line break - the html appeared to have been generated in word http://www.fileformat.info/info/unicode/char/2028/encoding.htm
Discussions with Tim:
(2:27:07 PM) totten: eileen: two reactions:
(2:27:29 PM) totten: (a) if angular.toJson doesn't produce valid json for the funny char... then that seems like an upstream bug
(2:28:01 PM) totten: b(b) the basic point of that code is to take the "params" and strip out some special fields that angular puts its own tracking purposes
(2:28:33 PM) totten: angular.toJson() knows how to strip out those fields - but if there's another way, we could change
(2:28:34 PM) eileen: ok...
(2:28:43 PM) totten: and workaround bug in angular.toJson
(2:30:56 PM) eileen: hmm - so, look for specific strings first?
(2:32:26 PM) eileen: the hex of the char that is ACTUALLY hitting me seems to be E280A8
(2:32:41 PM) eileen: (if this is correct) hex(mid(body_html, 1777, 1)),
(2:34:07 PM) eileen: which seems to mean it is a multibyte character
(2:34:54 PM) totten: eileen: fwiw – https://github.com/angular/angular.js/blob/master/src/Angular.js#L1163
(2:34:55 PM) totten: and
(2:34:55 PM) totten: https://github.com/angular/angular.js/blob/master/src/Angular.js#L1126
(2:35:38 PM) totten: JSON.stringify seems to be defined by browser – http://caniuse.com/#feat=json – don't see anywhere in our codebase that defines it