Hi,
I have a webapplication in perl which uses UTF-8 everywhere. At the top of my scripts is "use open ':utf8';" and "use open ':std';" which makes everything work correctly. Without these lines 'special' characters that come f.e. from the database turn into question marks in the browser.
Recently I added a file upload option to the application, but when I try to upload, I get tons of errors in my log complaining about bad utf-8:
[Wed Aug 15 20:55:42 2007] [error] [client 127.0.0.1] [Wed Aug 15 20:5 +5:42 2007] script.pl: Malformed UTF-8 character (unexpected continuat +ion byte 0x99, with no preceding start byte) in index at (eval 44) li +ne 15., referer: http://localhost/formtest.html [Wed Aug 15 20:55:42 2007] [error] [client 127.0.0.1] [Wed Aug 15 20:5 +5:42 2007] script.pl: Malformed UTF-8 character (byte 0xff) in index +at (eval 44) line 15., referer: http://localhost/formtest.html [Wed Aug 15 20:55:42 2007] [error] [client 127.0.0.1] [Wed Aug 15 20:5 +5:42 2007] script.pl: Malformed UTF-8 character (unexpected non-conti +nuation byte 0x0d, immediately after start byte 0xd9) in index at (ev +al 44) line 15., referer: http://localhost/formtest.html [Wed Aug 15 20:55:42 2007] [error] [client 127.0.0.1] [Wed Aug 15 20:5 +5:42 2007] script.pl: Wide character in print at (eval 38) line 85., +referer: http://localhost/formtest.html
The uploaded file is totally corrupt when saved (btw I use CGI.pm). It seems that the file is not sent as UTF-8 for some unknown reason; I do specify UTF-8 charset in my forms and html, and the http headers confirm that it's supposed to be UTF-8.
When I remove the two "use open" lines from my perl script, the uploads go fine, but then the special chars are screwed in my app. It's a multi lingual site so correct display of special chars like c cedille and umlauts is essential. Hence the choice for UTF-8.
I'm caught between a rock and a hard place. How do I get out?In reply to UTF-8 woes with file upload by Farenji
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |