Hi,
I am using Seaside with FusionCharts. XML data file for FusionCharts is generated by this code: url := (html urlForAction: [ self session returnResponse: (Seaside.WAResponse new contentType: 'text/xml'; nextPut: 239 asCharacter; nextPut: 187 asCharacter; nextPut: 191 asCharacter; nextPutAll: chart xmlString; yourself) ]). 239, 187 and 191 characters is BOM mark for UTF-8 (EF BB BF) - but this 3 characters are messed in responce to "C3 AF C2 BB C2 BF" - what is wrong? Thanks very much for suggestions, Petr Fischer (VW7.6dev, mac os x) _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Petr,
The string can not be sent over http, the change is due to String>>encodeForHTTP You can translate the string back to its original form by doing String>>unescapePercents 16rEFBBBF asByteArray asString encodeForHTTP = '%C3%AF%C2%BB%C2%BF' 16rEFBBBF asByteArray asString encodeForHTTP unescapePercents asByteArray hex = 'EFBBBF' Hope that helps, Ron Teitelbaum > -----Original Message----- > From: Petr Fischer > > Hi, > > I am using Seaside with FusionCharts. XML data file for FusionCharts > is generated by this code: > > > url := (html urlForAction: [ > self session returnResponse: > new > contentType: 'text/xml'; > nextPut: 239 asCharacter; > nextPut: 187 asCharacter; > nextPut: 191 asCharacter; > nextPutAll: chart xmlString; > yourself) > ]). > > 239, 187 and 191 characters is BOM mark for UTF-8 (EF BB BF) - but > this 3 characters are messed in responce to "C3 AF C2 BB C2 BF" - what > is wrong? > > Thanks very much for suggestions, Petr Fischer (VW7.6dev, mac os x) > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2008/3/6, Ron Teitelbaum <[hidden email]>:
> Hi Petr, > > The string can not be sent over http, the change is due to > String>>encodeForHTTP That doesn't make any sense. #encodeForHTTP is for urls, certainly not for the body of the response. Seaside has it's own implementation of #encodeForHTTP so there shouldn't even be any senders of it. I rather looks like you are using an "encoded" server adapter who is unaware of the BOM and tries to encode the BOM into utf-8. Doing the BOM by hand you most certainly do not want an "encoded" server adapter. Cheers Philippe > You can translate the string back to its original form by doing > > String>>unescapePercents > > 16rEFBBBF asByteArray asString encodeForHTTP = '%C3%AF%C2%BB%C2%BF' > > 16rEFBBBF asByteArray asString encodeForHTTP unescapePercents asByteArray > hex = 'EFBBBF' > > Hope that helps, > > > Ron Teitelbaum > > > > -----Original Message----- > > From: Petr Fischer > > > > Hi, > > > > I am using Seaside with FusionCharts. XML data file for FusionCharts > > is generated by this code: > > > > > > url := (html urlForAction: [ > > self session returnResponse: > (Seaside.WAResponse > > new > > contentType: 'text/xml'; > > nextPut: 239 asCharacter; > > nextPut: 187 asCharacter; > > nextPut: 191 asCharacter; > > nextPutAll: chart xmlString; > > yourself) > > ]). > > > > 239, 187 and 191 characters is BOM mark for UTF-8 (EF BB BF) - but > > this 3 characters are messed in responce to "C3 AF C2 BB C2 BF" - what > > is wrong? > > > > Thanks very much for suggestions, Petr Fischer (VW7.6dev, mac os x) > > _______________________________________________ > > seaside mailing list > > [hidden email] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Yup, our http server seems to be what you call "encoded" server adapter. So entering the BOM mark already encoded in utf-8 results in it being re-encoded yet again in utf-8. To achieve the desired effect the response should be built as:
Seaside.WAResponse new contentType: 'text/xml;charset=utf-8'; nextPut: 16rFEFF asCharacter; nextPutAll: chart xmlString; yourself Let the adapter do the utf-8 encoding of the BOM mark character (U+FEFF). Martin Philippe Marschall wrote: > 2008/3/6, Ron Teitelbaum <[hidden email]>: >> Hi Petr, >> >> The string can not be sent over http, the change is due to >> String>>encodeForHTTP > > That doesn't make any sense. #encodeForHTTP is for urls, certainly not > for the body of the response. Seaside has it's own implementation of > #encodeForHTTP so there shouldn't even be any senders of it. I rather > looks like you are using an "encoded" server adapter who is unaware of > the BOM and tries to encode the BOM into utf-8. Doing the BOM by hand > you most certainly do not want an "encoded" server adapter. > > Cheers > Philippe > >> You can translate the string back to its original form by doing >> >> String>>unescapePercents >> >> 16rEFBBBF asByteArray asString encodeForHTTP = '%C3%AF%C2%BB%C2%BF' >> >> 16rEFBBBF asByteArray asString encodeForHTTP unescapePercents asByteArray >> hex = 'EFBBBF' >> >> Hope that helps, >> >> >> Ron Teitelbaum >> >> >> > -----Original Message----- >> > From: Petr Fischer >> > >> > Hi, >> > >> > I am using Seaside with FusionCharts. XML data file for FusionCharts >> > is generated by this code: >> > >> > >> > url := (html urlForAction: [ >> > self session returnResponse: >> (Seaside.WAResponse >> > new >> > contentType: 'text/xml'; >> > nextPut: 239 asCharacter; >> > nextPut: 187 asCharacter; >> > nextPut: 191 asCharacter; >> > nextPutAll: chart xmlString; >> > yourself) >> > ]). >> > >> > 239, 187 and 191 characters is BOM mark for UTF-8 (EF BB BF) - but >> > this 3 characters are messed in responce to "C3 AF C2 BB C2 BF" - what >> > is wrong? >> > >> > Thanks very much for suggestions, Petr Fischer (VW7.6dev, mac os x) >> > _______________________________________________ >> > seaside mailing list >> > [hidden email] >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |