Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Broken response charset when using FileItem

    Hi Isomorphic,

    just found out that when using FileItem in a form, the RPC returns malformed characters. Very very strange IMHO. Have double checked and it only happens as far as i keep the FileItem in the form (no metter if image is beeing uploaded or is left empty).

    Thanks, Martin.

    Correct DSRequest:
    Code:
    {
        "dataSource":"DataSource_SicherheitsAuditOption", 
        "operationType":"update", 
        "componentId":"isc_ValuesManager_0", 
        "data":{
            "imageData":null, 
            "pointId":7, 
            "defect":"durchgeführten Teilaudits können ", 
            "finished":false, 
            "functionalUnit":"asd", 
            "id":16, 
            "locationObject":"asd", 
            "number":"asd", 
            "priority":null, 
            "responsible":"asd", 
            "solution":"durchgeführten Teilaudits können ", 
            "imageData$68c":"<img src='http://127.0.0.1:8888/sicherheitsaudit/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-12-27&isc_tnum=8&_transaction=%3Ctransaction%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2F10%2FXMLSchema-instance%22%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CtransactionNum%20xsi%3Atype%3D%22xsd%3Along%22%3E8%3C%2FtransactionNum%3E%3Coperations%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E16%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2Fcriteria%3E%3CoperationConfig%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CdataSource%3EDataSource_SicherheitsAuditOption%3C%2FdataSource%3E%3CoperationType%3EviewFile%3C%2FoperationType%3E%3C%2FoperationConfig%3E%3CappID%3EbuiltinApplication%3C%2FappID%3E%3Coperation%3EDataSource_SicherheitsAuditOption_viewFile%3C%2Foperation%3E%3ColdValues%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E16%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2FoldValues%3E%3C%2Felem%3E%3C%2Foperations%3E%3C%2Ftransaction%3E' width='225' height='150' align='TEXTTOP'  border='0' suppress='TRUE'/>"
        }, 
        "callback":{
            "target":[ValuesManager ID:isc_ValuesManager_0], 
            "methodName":"saveEditorReply"
        }, 
        "showPrompt":true, 
        "prompt":"Speichere Formulardaten...", 
        "oldValues":{
            "imageData":null, 
            "pointId":7, 
            "defect":"durchgeführten Teilaudits können ", 
            "finished":false, 
            "functionalUnit":"asd", 
            "id":16, 
            "locationObject":"asd", 
            "number":"asd", 
            "priority":null, 
            "responsible":"asd", 
            "solution":"durchgeführten Teilaudits können ", 
            "imageData$68c":"<img src='http://127.0.0.1:8888/sicherheitsaudit/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-12-27&isc_tnum=8&_transaction=%3Ctransaction%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2F10%2FXMLSchema-instance%22%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CtransactionNum%20xsi%3Atype%3D%22xsd%3Along%22%3E8%3C%2FtransactionNum%3E%3Coperations%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E16%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2Fcriteria%3E%3CoperationConfig%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CdataSource%3EDataSource_SicherheitsAuditOption%3C%2FdataSource%3E%3CoperationType%3EviewFile%3C%2FoperationType%3E%3C%2FoperationConfig%3E%3CappID%3EbuiltinApplication%3C%2FappID%3E%3Coperation%3EDataSource_SicherheitsAuditOption_viewFile%3C%2Foperation%3E%3ColdValues%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E16%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2FoldValues%3E%3C%2Felem%3E%3C%2Foperations%3E%3C%2Ftransaction%3E' width='225' height='150' align='TEXTTOP'  border='0' suppress='TRUE'/>"
        }, 
        "clientContext":{
        }, 
        "requestId":"DataSource_SicherheitsAuditOption$6279"
    }
    Correct RAW Response
    Code:
     {
            queueStatus:0, 
            isDSResponse:true, 
            invalidateCache:false, 
            status:0, 
            data:{
                imageData:null, 
                pointId:7, 
                defect:"durchgeführten Teilaudits können ", 
                finished:false, 
                functionalUnit:"asd", 
                id:16, 
                locationObject:"asd", 
                number:"asd", 
                priority:null, 
                responsible:"asd", 
                solution:"durchgeführten Teilaudits können "
            }
        }
    Correct DSRequest using FileItem in form:
    Code:
    {
        "dataSource":"DataSource_SicherheitsAuditOption", 
        "operationType":"add", 
        "componentId":"isc_DynamicForm_9", 
        "data":{
            "pointId":"4", 
            "defect":"durchgeführten Teilaudits können ", 
            "solution":"durchgeführten Teilaudits können ", 
            "functionalUnit":"asd", 
            "number":"asd", 
            "locationObject":"asd", 
            "responsible":"asd"
        }, 
        "callback":{
            "target":[DynamicForm ID:isc_DynamicForm_9], 
            "methodName":"saveEditorReply"
        }, 
        "showPrompt":true, 
        "prompt":"Speichere Formulardaten...", 
        "oldValues":{
        }, 
        "clientContext":{
        }, 
        "requestId":"DataSource_SicherheitsAuditOption$62720"
    }
    But incorrect response using FileItem in form:
    Code:
    {
            queueStatus:0, 
            isDSResponse:true, 
            invalidateCache:false, 
            status:0, 
            data:{
                imageData:null, 
                pointId:4, 
                defect:"durchgeführten Teilaudits können ", 
                finished:false, 
                functionalUnit:"asd", 
                id:18, 
                locationObject:"asd", 
                number:"asd", 
                priority:null, 
                responsible:"asd", 
                solution:"durchgeführten Teilaudits können ", 
                $81y:{
                    number:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    locationObject:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    functionalUnit:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    imageData:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    defect:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    solution:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    priority:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    responsible:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    finished:{
                        isNullMarker:true, 
                        $669:"isc_RCListGridOL_1_0_body", 
                        $81x:1
                    }, 
                    workflowButton:{
                    }
                }, 
                $29a:[
                    {
                    }
                ], 
                imageData$68c:"<img src='http://127.0.0.1:8888/sicherheitsaudit/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-12-27&isc_tnum=21&_transaction=%3Ctransaction%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2F10%2FXMLSchema-instance%22%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CtransactionNum%20xsi%3Atype%3D%22xsd%3Along%22%3E21%3C%2FtransactionNum%3E%3Coperations%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E18%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2Fcriteria%3E%3CoperationConfig%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CdataSource%3EDataSource_SicherheitsAuditOption%3C%2FdataSource%3E%3CoperationType%3EviewFile%3C%2FoperationType%3E%3C%2FoperationConfig%3E%3CappID%3EbuiltinApplication%3C%2FappID%3E%3Coperation%3EDataSource_SicherheitsAuditOption_viewFile%3C%2Foperation%3E%3ColdValues%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Cid%20xsi%3Atype%3D%22xsd%3Along%22%3E18%3C%2Fid%3E%3Cdownload_fieldname%3EimageData%3C%2Fdownload_fieldname%3E%3C%2FoldValues%3E%3C%2Felem%3E%3C%2Foperations%3E%3C%2Ftransaction%3E' width='225' height='150' align='TEXTTOP'  border='0' suppress='TRUE'/>"
            }
        }

    #2
    Guys, any news on this, need to have that fixed asap.

    Comment


      #3
      We're investigating, please bear with us

      Comment


        #4
        Can you show the code for a minimal form that causes this problem? We are trying to to reproduce the problem, but so far have not been able to.

        Comment


          #5
          Also, which browser(s) are you seeing this problem with? We are beginning to suspect that the problem is browser-specific.

          Comment


            #6
            Hi,

            this is the form, pretty simple. SMTextItem and SMTextArea directly extend TextItem and TextAreaItem and just use the composite constructor to set properties, no custom code there:

            Code:
            private DynamicForm initForm() {
            
            		DynamicForm form = new DynamicForm();
            
            		// Text Fields
            		SMTextItem number = new SMTextItem("number", Utils.getTexts().numberAcronym(), 8, true);
                    SMTextItem locationObject = new SMTextItem("locationObject", Utils.getTexts().locationObject(), 255, true);
            		SMTextItem functionalUnit = new SMTextItem("functionalUnit", Utils.getTexts().functionalUnit(), 255, true);
            		SMTextItem responsible = new SMTextItem("responsible", Utils.getTexts().responsible(), 255, true);
            
            		// Text Areas
            		SMTextAreaItem defect = new SMTextAreaItem("defect", Utils.getTexts().defect(), 300, 150, false, true, 1);
            		defect.setTitleStyle("rc-formItemTitle");
            		defect.setRequired(true);
            		defect.setTitleVAlign(VerticalAlignment.TOP);
            
            		// Image Upload Item
            		FileItem imageUploadItem = new FileItem("imageData", "<b>" + Utils.getTexts().image() + "</b>");
            		imageUploadItem.setTitleStyle("rc-formItemTitle");
            
            		form.setFields(number, locationObject, functionalUnit, imageUploadItem,	defect, responsible);
            
            		return form;
            
            }
            Browsers i've checked are: Chrome 16, FF 6, IE 6, IE 9.

            Comment


              #7
              We eventually got to the bottom of this, and it turns out to be a known and documented issue, although not one that is really confined to the use of FileItem. However, the article documenting this is not present in the SmartGWT docs because there are elements of it that are not applicable to SmartGWT. We will rework things to make sure that relevant important information is present; in the meantime, please follow the advice on Content Encodings in this equivalent SmartClient article (but ignore the rest of the article): http://www.smartclient.com/docs/8.2/...ml#group..i18n
              Last edited by Isomorphic; 6 Feb 2012, 15:13.

              Comment


                #8
                Hi Isomorphic,

                i have the contentType page directives as well as meta headers on every page, i have also added this now to the DSResponse that i'm sending back from the dataSource, but it didn't help.

                Code:
                response.setExportHeader("Content-Type: text/html; charset=UTF-8");
                P.S.:

                Just to make sure we are on the same line here, it's the text fields that are broken, not the file itself.
                Last edited by mpetransky; 7 Feb 2012, 01:58.

                Comment


                  #9
                  So, if you look at the response for your bootstrap .html or .jsp file using something like Fiddler, does it have a content-type header specifying charset=UTF-8?

                  Comment


                    #10
                    Yes, this is from firebug:

                    Code:
                    Content-Type	text/plain; charset=utf-8
                    this is the raw response:
                    Code:
                    //isc_RPCResponseStart-->[{queueStatus:0,isDSResponse:true,invalidateCache:false,status:0,data:[{imageData:null,pointId:4,defect:"Mangel DE",finished:false,functionalUnit:"q",id:6,locationObject:"q",number:"q",priority:null,responsible:"q",solution:"Losung DE"},{imageData:null,pointId:4,defect:"Mangel DE",finished:false,functionalUnit:"asd",id:8,locationObject:"asd",number:"asd",priority:null,responsible:"asd",solution:"Losung DE"},{imageData:null,pointId:4,defect:"bootstrap ",finished:false,functionalUnit:"durchgeführten Teilaudits können ",id:9,locationObject:"sdf",number:"sdf",priority:null,responsible:"sdf",solution:"Deutschland grenzt an neun europäische Nachbarstaaten; naturräumlich grenzt es an die Gewässer der Nord- und Ostsee und im Süden an das Bergland der Alpen. Es liegt in der gemäßigten Klimazone und zählt mit rund 81,8 Millionen Einwohnern zu den dichtestbesiedelten Flächenländern der Erde."},{imageData:null,pointId:4,defect:"Unseres Erachtens werden nicht\ngenügend Kontrollen durchgeführt oder die nötigen ",finished:false,functionalUnit:"sdf",id:10,locationObject:"sdf",number:"sdf",priority:"P1",responsible:"sdf",solution:"Deutschland grenzt an neun europäische Nachbarstaaten; naturräumlich grenzt es an die Gewässer der Nord- und Ostsee und im Süden an das Bergland der Alpen. Es liegt in der gemäßigten Klimazone und zählt mit rund 81,8 Millionen Einwohnern zu den dichtestbesiedelten Flächenländern der Erde."},{imageData:null,pointId:4,defect:"Die hauptsächlichsten Mängel sind nach wie vor im organisatorischen Brandschutz in den internen Bereichen anzutreffen. Es sind deshalb unbedingt verstärkte organisatorische Massnahmen zu ergreifen, vor allem in Bezug auf Brandverhütung und allgemeine Ordnung.\n\nWegen Platzknappheit sind in mehreren Technikräumen, die nach den Vorschriften der Feuer-polizei allgemein frei von Waren frei zu halten wären, weiterhin grössere Brandlasten vorhanden.",finished:false,functionalUnit:"q",id:11,locationObject:"q",number:"q",priority:null,responsible:"q",solution:"Die hauptsächlichsten Mängel sind nach wie vor im organisatorischen Brandschutz in den internen Bereichen anzutreffen. Es sind deshalb unbedingt verstärkte organisatorische Massnahmen zu ergreifen, vor allem in Bezug auf Brandverhütung und allgemeine Ordnung.\n\nWegen Platzknappheit sind in mehreren Technikräumen, die nach den Vorschriften der Feuer-polizei allgemein frei von Waren frei zu halten wären, weiterhin grössere Brandlasten vorhanden."},{imageData:null,pointId:4,defect:"Wegen Platzknappheit sind in mehreren Technikräumen, die nach den Vorschriften der Feuer-polizei allgemein frei von Waren frei zu halten wären, weiterhin grössere Brandlasten vorhanden.",finished:false,functionalUnit:"asd",id:12,locationObject:"asd",number:"asd",priority:null,responsible:"asd",solution:"a"},{imageData:null,pointId:4,defect:"and ä appears",finished:true,functionalUnit:"a",id:13,locationObject:"a",number:"a",priority:"P3",responsible:"asd",solution:"and ä appears"},{imageData:null,pointId:4,defect:"durchgeführten Teilaudits können 080-.DNà ",finished:false,functionalUnit:"durchgeführten Teilaudits können ",id:14,locationObject:"asd",number:"asd",priority:null,responsible:"asd",solution:"asd"},{imageData:null,pointId:4,defect:"durchgeführten Teilaudits können ",finished:false,functionalUnit:"asd",id:18,locationObject:"asd",number:"asd",priority:null,responsible:"asd",solution:"durchgeführten Teilaudits können "}],exportHeader:"Content-Type: text/html; charset=UTF-8"}]//isc_RPCResponseEnd
                    Last edited by mpetransky; 7 Feb 2012, 04:28.

                    Comment


                      #11
                      OK, thanks - we see the issue. There is a long-standing server-side bug in the framework that only shows itself under certain circumstances (which never crop up in our test and development environments, hence the trouble we've had pinning this down).

                      We have committed a fix for this, which will be present in tomorrow's 3.1d and 3.0p builds. Note that all that other stuff about setting charset and content-type headers is still required.

                      Comment


                        #12
                        Hi Isomorphic,

                        thank you! Btw. we are still using SmartGWT 2.5, will it be available there as well ?

                        Comment


                          #13
                          Yes it will

                          Comment


                            #14
                            Ok, thank you.

                            Comment


                              #15
                              It works, thanks a lot!

                              Comment

                              Working...
                              X