in reply to UTF-8 and PSGI/Starman vs. CGI
Probably your setup is broken all the way through and it only acts correctly in the CGI/Apache level because it's broken in the same ways in the same places; e.g., maybe you're not reading or writing UTF-8 in your DB but stuffing the bytes into Latin-1 or something and they are read the same way they are written so the breakage is transparent and seems correct.
Every step has to be right for UTF-8 to be robust/correct. That means the HTTP headers, the webserver's output of the code's output, the forms and the decoding of their input, the DB, the code that reads and writes the DB all have to be properly declared/configured and encode and decode in agreement.
I would start with the DB because that's usually the root of the problem in my experience. Google for "check table charset {DB type}" or something like that to make sure the tables are using UTF-8. Then work backwards. DBI+yourDBD calls with proper UTF-8 setup. Then decoding form input and matching output level encoding in your code. Then app server (FCGI/nginx). Then webserver. Making errors fatal at all levels is helpful too.
Tangent: uWSGI is a better choice than Starman.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: UTF-8 and PSGI/Starman vs. CGI
by stevieb (Canon) on Mar 21, 2018 at 16:49 UTC | |
by Your Mother (Archbishop) on Mar 21, 2018 at 17:14 UTC | |
by karlgoethebier (Abbot) on Mar 22, 2018 at 11:39 UTC | |
by dsheroh (Monsignor) on Mar 22, 2018 at 12:34 UTC | |
by stevieb (Canon) on Mar 21, 2018 at 17:33 UTC | |
Re^2: UTF-8 and PSGI/Starman vs. CGI
by dsheroh (Monsignor) on Mar 22, 2018 at 08:06 UTC | |
by Your Mother (Archbishop) on Mar 22, 2018 at 14:42 UTC | |
by dsheroh (Monsignor) on Mar 23, 2018 at 11:07 UTC |