I have problem with directly inserting foreign characters like \"ó,č,ĕ,ř\" characters into database. dont working even with my php frontend to be sure there is no transformation
If your shell is in latin1 encoding, as it appears from the comments, this will fix it:
set client_encoding = 'latin1';
If you don't want to change the client's system encoding you can change the default in postgresql.conf
client_encoding = latin1
Or change PHP's default character encoding:
default_charset = "utf-8";
Do it also in the Apache, or whatever http server you are using, config:
AddDefaultCharset UTF-8
According to the comments you're using PuTTY, which defaults to latin-1. You need to configure PuTTY to use UTF-8. Just setting the server locale won't do any good unless your PuTTY encoding matches what the environment claims the encoding is.
Open PuTTy. Under the Window settings heading choose the Translation sub-heading. Set "Remote character set" to "utf-8". In the Fonts sub-tab make sure you are using a font with reasonable Unicode coverage. Then, in the Session menu type a name into the "saved settings" text entry box and type "save" to save your settings as a profile. You can override the "Default Settings" profile by selecting it and setting Save, but this will affect all future connections and new profiles so it may cause confusion if you use other servers that aren't utf-8.
(These instructions are based on my PuTTY on Fedora 18; there may be some differences in UI details in the recent Windows versions. If in doubt, search for how to set PuTTY to use utf-8.)
Just another debugging test (I still think it's a terminal thing): can you write the insert statement in a UTF-8 encoded file and try to run the command from the file? Eg:
psql my_db -U postgres -f <utf8-encoded-file>
If this works fine then it's back to the terminal somehow ...