Something weird going on here…
I’ve a URL to an InfoPath form which renders in the browser. Here is the URL
If I start IE and paste in this URL, it works fine.
If I create a desktop icon and click on it, it works fine.
But, if I paste the URL into Word 2010 or Excel 2010 and then click on it, I get the following:

The form never loads. The Javascript error is
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E)
Timestamp: Fri, 31 Dec 2010 17:08:08 UTC
Message: Syntax error
Line: 380
Char: 90
Code: 0
URI: http://sp2010/_layouts/FormServer.aspx?XsnLocation=http://sp2010/TestForm/forms/template.xsn&OpenIn=browser&SaveLocation=http://sp2010/TestForm&Source=http://sp2010/TestForm
Message: ‘g_objCurrentFormData_Error’ is undefined
Line: 549
Char: 3
Code: 0
Here is line 380
var g_objHasFormPostedBack_FormControl=false;var g_objCurrentFormData_FormControl = [[],[1,[[[2,[0,["","","",-1],[[3,["",["","","",-1],[],false,false,false],-1,false,false,3]],false],-1,false,false,3]],false,[0,0],[1],false],-1,false,false,3],0,”25f04190a0d34663b6ddd45e1bf7966e_ba7c22eb533544e8b20b16a243729ec2″,”AHYXKHSEFSKL2R5RS2PME3RRTJ2RYL2UIVJVIRSPKJGS6RSPKJGVGL2UIVGVATCBKRCS4WCTJYVWE5TIPFDGC4KJOBYVU4DZNNBG2NKCKJWFQSSUIFSTMTTFIZLDEUKMGZLVQ5DQOMZE2S3TA”,1033,”2010-12-31T17:05:57″,”2010-12-31″,["0","","http:\u002f\u002fsp2010\u002fTestForm\u002fforms\u002ftemplate.xsn","http:\u002f\u002fsp2010\u002fTestForm\u002f","http:\u002f\u002fsp2010\u002fTestForm\u002fforms\u002ftemplate.xsn","http:\u002f\u002fsp2010\u002fTestForm",1,0,"FormControl",0,false],”View 1″,0,false,”TestForm – New Form”,1,”",”http:\u002f\u002fsp2010″,”ltr”,”http:\u002f\u002fsp2010″,6.34294119577127E+17,”0″,”",false,1033,”http:\u002f\u002fsp2010″,[],false,true,”",”",”0″,false,”",true,2,”",”",”",”puN2wNKuBBJ\u002fcJfi\u002fht858J7Kvg5lmIm3Ab\u002foyQb9bCuc13KdA2g5VC5SATX4mcEeMyOPR8V5fq6oC0bSAFFAQ==|634294119576971096″];
Some pretty weird looking characters after the second equals sign. If I refresh the page (F5) it works.
Line 380 now a more healthy looking
var g_objHasFormPostedBack_FormControl=false;var g_objCurrentFormData_FormControl = [[],[1,[[[2,[0,["","","",-1],[[3,["",["","","",-1],[],false,false,false],-1,false,false,3]],false],-1,false,false,3]],false,[0,0],[1],false],-1,false,false,3],0,”25f04190a0d34663b6ddd45e1bf7966e_dab1b19fd5bd43229c497a0710468307″,”AHYXKHSEFSKL2R5RS2PME3RRTJ2RYL2UIVJVIRSPKJGS6RSPKJGVGL2UIVGVATCBKRCS4WCTJYVWE5TIPFDGC4KJOBYVU4DZNNBG2NKCKJWFQSSUIFSTMTTFIZLDEUKMGZLVQ5DQOMZE2S3TA”,1033,”2010-12-31T17:17:07″,”2010-12-31″,["0","","http:\u002f\u002fsp2010\u002fTestForm\u002fforms\u002ftemplate.xsn","http:\u002f\u002fsp2010\u002fTestForm\u002f","http:\u002f\u002fsp2010\u002fTestForm\u002fforms\u002ftemplate.xsn","http:\u002f\u002fsp2010\u002fTestForm",1,0,"FormControl",0,false],”View 1″,0,false,”TestForm – New Form”,1,”",”http:\u002f\u002fsp2010″,”ltr”,”http:\u002f\u002fsp2010″,6.34294126273283E+17,”0″,”",false,1033,”http:\u002f\u002fsp2010″,[],false,true,”",”",”0″,false,”",true,2,”",”",”",”ye\u002fl3NLOSE8tEEvuHJw\u002bV8BbPew9HmxiavUkjgd\u002b\u002bkYa\u002f1J82qWX\u002bpwjlvGijygad0J6I7Vkp3onbQv56VLbwA==|634294126273282857″];
So why should clicking a link in Word 2010 or Excel 2010 be any different to following any other hyperlink? Over to Microsoft on this one I think! Anyone any ideas?
UPDATE: It seems a bit intermittent. Also setting the regional settings of the SharePoint site to “English (UK)”, the same as my client computer, seems to fix the problem.
Here is my theory. Your Infopath form uses a resource file that you edited with a text editor that does not save Unicode in the same way as Microsoft tools (SharePoint Designer or Infopath Designer). Those “” characters are the UTF-8 Byte Order Mark, as rendered in ISO-8859-1 (Latin 1) encoding. These invisible characters occur at the beginning of the file to tell the process reading it which encoding is being used for Unicode. If the process doing the reading isn’t expecting it, these bytes get read as file content. IIS, SharePoint, and your browser all do some guessing as to the character encoding that should be assumed when it’s not made explicit.