Bizarre unicode behavior in mod_perl vs CGI
Shane McCarron <[email protected]> Wed, 19 Mar 2014 16:14:10 -0500
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <CACCbJAb9uj9OKysNhJ9F46W4vwDPiXWqb0_pXUzm_1Mr9f3YfA@mail.gmail.com> |
(This message is about Mason 1.) I have a very complex application environment. Part of the compexity is that it permits my users to set it up using CGI or mod_perl (or FastCGI, but let's ignore that). In most cases, people use the application with a charset encoding of UTF-8. With me so far? In addition to the normal Mason components (ones that emit HTML), I have a handful of components that are used in AJAX requests and return JSON. The JSON is created using the JSON Perl module with the method to_json to serialize a Perl data structure. The data that is encoded is a potentially complex data structure that includes strings, arrays, whatever. The data comes out of BerkeleyDB files that are created and managed by this same application, so the round trip of the data into the database *should be* isomorphic. It appears to be from the logging and simple testing I have done. Regardless, this all works great, unless any of the strings are UTF-8. If a string contains UTF-8 data, that data appears to be correct while processing (I can log it and it comes out as you would expect), and when I generate the json with to_json it is also still correct. However, when the data is sent to Apache via $m->out, it gets encoded into UTF-8 AGAIN (so the UTF-8 characters become escaped ASCII effectively). But this ONLY happens when $m->out sends the data out via mod_perl. When in CGI mode it is perfect. Again, I recognize that this is complex, and in order to really help me out it would be good to have a simple test case, but there is very little that is simple about this environment. I was hoping someone might have seen this before and have a simple hint. Meanwhile, I will continue to rip my hair out. -- Shane McCarron [email protected] ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Mason-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mason-users