[Catalyst] uri_for and unicode

Alex Povolotsky tarkhil at over.ru
Tue Mar 9 19:54:43 GMT 2010


On 03/09/10 17:05, Bernhard Graf wrote:
>
> Then you are probably doing it wrong!
>
> I suspect that you want to use cyrillic characters. The problem is, that
> most software components (also Perl) default to latin1 or similar.
>
> A good start is always to use utf-8 encoding everywhere: your source
> code, your web pages encoding and your database charset.
>
> Always
>
>    use utf8;
>
> in your Perl file!
> (unless you are absolutely sure, you are not using any non-ASCII chars)
>    
yes
> Explicitly set your databases encoding to utf-8 on connect (see the
> appropriate DBD::*/DBIC manpages how to do that) and don't use
> DBIx::Class::UTF8Columns.
>
>    
yes, yes
> Tip for MySQL: To check that your data isn't accidently double-encoded,
> you might want to use length(). This function returns the number of
> bytes, so e.g. if a field contains the string 'süß', length(field)
> returns 5 (because ü and ß are encoded in 2 bytes in utf-8). If it is
> not 5, your data encoding is borked.
>    

All data is shown correctly, sorted correctly, appears in database 
correctly. Problems arises in uri_for and (so far) only in uri_for

Alex.




More information about the Catalyst mailing list