it works for this particular file but not for my complex script
I do not understand. What is a complex script? What does not work? Explain this, use more words.
How can I force CGI to use utf8 as default?
Exactly as I have shown. There are several parts to it:
1. use utf8; lets you write literal UTF-8 characters in Perl source code. If you always use Perl escapes instead, such as \x{11b} and HTML escapes, such as ě, so that you have ASCII-only source-code, this pragma is not neccesary.
2. The header method sets the HTTP header with the appropriate encoding. You seem to be under the misconception that <meta name="charset" content="utf-8"/> is enough. In fact the HTTP header is always relevant, and the in-file meta header only is taken into consideration when the HTTP header is absent, e.g. when the HTML is loaded from the file system.
3. CGI writes to STDOUT. The binmode method inherited from IO::Handle sets the encoding to UTF-8 for any STDOUT output, e.g. print method.
And how is it possible that all other national chars (ščřžýáíéůú) are good
I do not understand this question. All characters have the same properties, or nearly so, so of course they behave the same as with ě from the original example. Perhaps you should start to show some source code to demonstrate what you mean.
In reply to Re^3: CGI.pm encoding - wrong encoding for ě
by Anonymous Monk
in thread CGI.pm encoding - wrong encoding for ě
by koszta5
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |