вторник, 17 мая 2011 г.

Смена кодировки у Postgresql

Imagine you have a old postgresql database. Further imagine it has it's encoding set to something like LATIN-1 but some PHP web application has put in UTF-8 strings. Now what would you do if you have some python application actually respecting the encoding and recoding the db content from latin-1 to UTF-8 giving you garbage. Seems you can easily trick postgresql to now believe it is UTF-8:

UPDATE pg_database SET encoding = 6 WHERE datname = 'foo';

For a summary of these magic numbers the PostgreSQL Manual is usefull.

вторник, 10 мая 2011 г.

Disallow Key Characters

Сообщение "Disallow Key Characters" возникает только в Mozilla Firefox при просмотре сайта.
Виновником этого сообщения в 99% является неверная установка cookies. В таком поведении замечены GoogleAnalytics и плагин jQuery.UI.Tabs. Быстрое решение - очистить cookies, более правильное - переработать скрипты, выставляющие cookies так, чтобы в ключ попадали только символы (a-z0-9_)