I have two originally-identical webapp servers, both connecting to the same back end database. When they were first set up, both of them ran the webapp through apache and plain old CGI. Since CGI was being extremely slow (who would've thought?), I changed one of the servers over to nginx/PSGI/starman.

Now I have triple- or quadruple-encoding (I'm not sure which) issues with UTF-8 characters on the starman box, but UTF-8 works perfectly on the apache box.

I get the exact same results regardless of whether I talk to nginx or go to the starman server directly, so I'm confident that nginx is not the issue. It's also plainly not the database because both of them are connecting to the same database. The webapp source directory is on the same git branch and commit with no untracked files on either machine, so they should be running identical code and their config files have the same md5sum. As far as I can tell, apache/CGI vs. starman/PSGI is the only difference between them.

As an example, doing a search in the webapp for "ångbåten" returns 10 hits for "ångbåten" on the apache server, and 0 hits for "Ã¥ngbÃ¥ten" via starman. Since it's triple/quadruple-encoded and returns no hits, I figure it must be getting double-encoded on the way in (when it reads the search terms), then double-encoded again on the way out (when displaying the results).

Any ideas for what I might have messed up in either the starman startup or the PSGI file to cause this issue?

Bonus Question: Is there any way to get starman to put timestamps in its error log? It would be very useful to be able to tell whether an error just happened or if it's three days old.


In reply to UTF-8 and PSGI/Starman vs. CGI by dsheroh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.